On Sep 15, 3:04 pm, Matias Surdi <matiassu...@gmail.comwrote:
aditya shukla escribió:
How can we convert .py files to batch files? is there any library for this?
Aditya
------------------------------------------------------------------------
--
http://mail.python.org/mailman/listinfo/python-list
Maybe py2exe can help you.
I assume you are on Windows? Let's assume you have a file stuff.py
that reads:
import os
print os.listdir('.') # list current directory, good enough for
testing...
Then, insert the following line at the top:
@setlocal enableextensions & python -x %~f0 %* & goto :EOF
Now save this file as stuff.cmd somewhere along your PATH. Now calling
'stuff' should execute your file.
On Linux, you would instead insert the shebang line that points to
your python interpreter, such as
#!/usr/bin/python
at the top and also set the executable bit, but I suppose if you use
Linux at all you know that.