[Tutor] Popen? or something else

Max Noel maxnoel_fr at yahoo.fr
Thu Dec 23 02:05:57 CET 2004


On Dec 22, 2004, at 22:24, Israel C. Evans wrote:

> Fun!
>
> testo = [line for line in commands.getoutput('ls -la').split('\n')]
> for line in testo:
>    print line
>
> spits out nicely formatted ls data.
>
> It's Shelly!

I haven't tried it, but the above code looks like it could be 
simplified to:


for line in commands.getoutput('ls -la').split('\n'):
	print line


Or, of course, the obvious:

print commands.getoutput('ls -la')

-- Max
maxnoel_fr at yahoo dot fr -- ICQ #85274019
"Look at you hacker... A pathetic creature of meat and bone, panting 
and sweating as you run through my corridors... How can you challenge a 
perfect, immortal machine?"



More information about the Tutor mailing list