mardi 20 février 2007

[Python] How to get the output from os.system() into a variable ?

A quick solution using popen :

import os
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

Source of this

Aucun commentaire: