[Tutor] how to add arguments to a command line program

Tom Tucker tktucker at gmail.com
Fri Sep 14 19:26:59 CEST 2007


See optparse <http://docs.python.org/lib/module-optparse.html> or
sys.argv.<http://effbot.org/librarybook/sys.htm>



On 9/14/07, shawn bright <nephish at gmail.com> wrote:
>
> lo there all,
>
> i want to write a program that will be called from another program.
> I need to pass it one variable.
> i suppose i could also do this with a module, and create a new instance of
> whatever i want to pass it to,
> but all the same, how would i go about this. like if i had a program that
> i wanted to pass a number into.
>
> i am sure i do it with sys args, but don't know how.
>
> like
>
> python run_my_script.py somevar
>
> does this make sense ?
>
> The other way to do this is create a class i suppose that could be called.
> Should probably do it that way, but still, i would like to know.
>
> thanks.
>
> shawn
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20070914/241116f4/attachment.htm 


More information about the Tutor mailing list