<div dir="ltr"><div>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:<br><br></div><div>
my_var = "ls -l my_file"<br></div><div><br></div>So far the best I've seen is:<br><br>line = os.popen('ls -l my_file', stdout=subprocess.PIPE, shell=True)<br>(out, err) = line.communicate()<br><br clear="all">
<div><div>With no way to make 'my_file' a variable. <br><br></div><div>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.<br>
<br>Leam<br><br></div><div>-- <br><div><a href="http://leamhall.blogspot.com/" target="_blank">Mind on a Mission</a></div>
</div></div></div>