窗口“打开方式"python py2exe 应用程序 [英] Windows "open with" python py2exe application

查看:77
本文介绍了窗口“打开方式"python py2exe 应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道 Windows 的用...打开文件"功能是如何工作的.或者更确切地说,如果我用 python 编写一个程序,用 py2exe 编译一个可执行文件,然后希望能够通过右键单击并在打开方式"中选择它来打开该程序中的某些文件,该怎么办.

I wonder how the Windows "Open file with..." feature works. Or rather, how would do if I write a program in python, compile a executable with py2exe and then want to be able to open certain files in that program by right-clicking and choose it in "Open with".

文件是否只是作为参数传递,例如CMD>C:/myapp.exe 文件"?

Is the file simply passed as an argument, like "CMD>C:/myapp.exe file"?

推荐答案

是的,文件路径作为参数传入,可以通过 sys.argv[1] 访问.

Yep, the path to the file gets passed in as an argument and can be accessed via sys.argv[1].

这篇关于窗口“打开方式"python py2exe 应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆