Saad, please don't send HTML emails, as it destroys the essential 
formatting of your code.


On Mon, Oct 29, 2012 at 11:06:14AM +0500, Saad Javed wrote:

> How can I make this program run with the default value of x if I don't
> specify an argument at the command line?

arguments = sys.argv[1:]  # get the list of command line arguments
if arguments:
    # There are some.
    process(arguments)
else:
    # There are no arguments.
    do_something_else()



Or if you prefer, check that len(sys.argv) > 1.



-- 
Steven
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to