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?"


_______________________________________________
Tutor maillist  -  [EMAIL PROTECTED]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to