command substitution
Joonas Paalasmaa
joonas at olen.to
Mon Jul 16 06:21:00 EDT 2001
Raphael Bauduin wrote:
>
> Hi!
>
> I was looking for a solution like in bash, which let you put the standard
> output of a command in a variable(in bash, you can do it like OUT=`ls` or
> OUT=$(ls) ).
>
> If you have another way to take the standard output of a command and put it
> in a variable, it would be helpfull too.
out = popen("ls", "r").read()
And if you want a list of files.
out = popen("ls", "r").readlines()
More information about the Python-list
mailing list