[Tutor] question on python!

Magnus Lycka magnus@thinkware.se
Wed Nov 20 19:14:03 2002


At 05:30 2002-11-21 +0530, sachin mehra wrote:
>I want to incorporate some unix commands in my python program.How can i do 
>it? How about I want to execute 3-4 unix commands continuously??

Perhaps you can show what you would do from the
unix command line.

Typically you use os.system('ls -l') or whatever if you
don't need to process the output of the unix commands in
the python program.

If you need the output, you do something like
pingData = os.popen('ping www.python.org').readlines() etc.

You can obviously use the ordinary unix shell magic fo run
more than one command in os.system or os.popen. It's easier
to say if you show what you need to do.


-- 
Magnus Lycka, Thinkware AB
Alvans vag 99, SE-907 50 UMEA, SWEDEN
phone: int+46 70 582 80 65, fax: int+46 70 612 80 65
http://www.thinkware.se/  mailto:magnus@thinkware.se