A quick solution using popen :
import os
result=os.popen('command').read()
print result
where command is your command (expl. on windows: dir,ipconfig,...)
If you expect more than a line and want each word in a list:
import os,string
result=string.split(os.popen('dir/w').read())
Source of this
mardi 20 février 2007
[Python] How to get the output from os.system() into a variable ?
Inscription à :
Publier les commentaires (Atom)
Aucun commentaire:
Enregistrer un commentaire