tags:

views:

57

answers:

2

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
+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