By using system command i want to open '.py' in the notepad. Ex assume i have "Fact.py" file. Now i want to write a program which will open this file in notepad and we can edit this file.
+1
A:
import os
os.system("notepad.exe fact.py")
should do it, assuming the Notepad program is in your system's path.
unwind
2009-06-05 08:30:10
+8
A:
It's best to use subprocess for this, since this will avoid having to deal with quoting files containing spaces etc for the shell.
import subprocess
subprocess.call(['notepad','Fact.py'])
Brian
2009-06-05 08:33:14