Accepting File Argument in Python (from Send To co

2019-04-12 10:55发布

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 :)

2条回答
Animai°情兽
2楼-- · 2019-04-12 11:16
import sys

for arg in sys.argv:
  print arg
查看更多
登录 后发表回答