How execute a .py in this way?

Peter Cai newptcai at gmail.com
Sun Jul 3 13:05:57 EDT 2005


If it's a executable file, a ".exe" file, you can launch it in this
way, "xxx.exe < input.txt". The text file "input.txt" will be
considered as the standard input.

But when I use this trick on python, it doesn't work. The only way to
do so is like this "python xxx.py < input.txt". But this method has a
problem, that you have to include the full path of "xxx.py" unless
it's in your current folder even if "xxx.py" is in a folder which has
been include in the eviorment variable "path" on windows. Thus, you
can execute you "py" program anywhere by using the command "xxx.py",
but when you want to use an exsiting file as it's input, you have to
use something like "pythong xxx.py < input.txt".

It's very inconvenient as I tried to make my python programs cowork with vim.

Sorry for my poor english!	
delete



More information about the Python-list mailing list