Run Unix shell command $ parse command line arguments in python

Simon Brunning simon.brunning at gmail.com
Fri Apr 22 06:28:02 EDT 2005


On 22 Apr 2005 03:16:02 -0700, hue <prasad413in at gmail.com> wrote:
> Thanks for your reply
> 
> I started writing the script.. I have gone through documentation for
> getopt

(snip)

Good start. I tend to prefer optparse over getopt these days, but if
you've got it working the way you want it, you should probably stick
with what you have.

> with the above code, I am planning to do command line parsing. But how
> to run unix shell command? DO i have to use os Module/  import command?
> 
> How should i proceed further, to
>  import commands
>  commands.getstatusoutput('ls /bin/ls')

You'll certainly need to import *something*. Have you looked at the
subprocess module?

-- 
Cheers,
Simon B,
simon at brunningonline.net,
http://www.brunningonline.net/simon/blog/



More information about the Python-list mailing list