在 Python 中接受文件参数(从“发送到”上下文菜单)

发布于 2024-07-10 07:00:54 字数 493 浏览 5 评论 0原文

首先我要指出的是,我几乎没有 Python 经验。

替代文本 http://www.aquate.us/u/9986423875612301299.jpg

作为您可能知道,只需在 Windows PC 上的“发送到”文件夹中放置一个快捷方式,您就可以允许程序将文件作为参数。

我将如何编写一个使用该文件作为参数的 python 程序?

而且,如果有人有机会的话,作为奖励—— 我如何将其与 urllib2 集成以将文件 POST 到我的服务器上的 PHP 脚本?

提前致谢。

编辑 - 另外,如何使某些内容显示在“发送到”菜单中? 我的印象是,您只需将快捷方式放入 SendTo 文件夹中,它就会自动在菜单中添加一个选项... 没关系。 我发现我做错了什么:)

I'm going to start of by noting that I have next to no python experience.

alt text http://www.aquate.us/u/9986423875612301299.jpg

As you may know, by simply dropping a shortcut in the Send To folder on your Windows PC, you can allow a program to take a file as an argument.

How would I write a python program that takes this file as an argument?

And, as a bonus if anyone gets a chance --
How would I integrate that with a urllib2 to POST the file to a PHP script on my server?

Thanks in advance.

Edit-- also, how do I make something show up in the Sendto menu? I was under the impression that you just drop a shortcut into the SendTo folder and it automatically adds an option in the menu...
Never mind. I figured out what I was doing wrong :)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文