I've been trying to so a simple "run a command and put the output into a
variable". Using Python 2.4 and 2.6 with no option to move. The go is to do
something like this:

my_var = "ls -l my_file"

So far the best I've seen is:

line = os.popen('ls -l my_file', stdout=subprocess.PIPE, shell=True)
(out, err) = line.communicate()

With no way to make 'my_file' a variable.

I've got to be missing something, but I'm not sure what. Python has always
impressed me a a language without a lot of hoops to go through.

Leam

-- 
Mind on a Mission <http://leamhall.blogspot.com/>
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to