passing arguments

Jeff Elkins jeffelkins at earthlink.net
Fri May 20 19:20:50 EDT 2005


On Friday 20 May 2005 06:46 pm, James Stroud wrote:
> import sys
>
> try:
>   arg1 = sys.argv[1]
> except IndexError:
>   print "This script takes an argument, you boob!"
>   sys.exit(1)
>
> OR, way better: See the optparse module.
>
> On Friday 20 May 2005 03:26 pm, Jeff Elkins wrote:
> > I'm sure this is obvious, but how the heck do pass an argument(s) to a
> > python script from the command line?
> >
> > Thanks,
> >
> > Jeff Elkins

Thanks!




More information about the Python-list mailing list