getting strings from the shell commands

Mark McEahern marklists at mceahern.com
Fri Dec 21 13:51:37 EST 2001


> I want to do something in python LIKE
> 
> os.system("./myscript") but how can i get the out put into a [list of]
> strings

try os.popen*

f = os.popen(command)
lines = f.readlines()
print '\n'.join(lines)
f.close()

// mark




More information about the Python-list mailing list