On 02/02/13 15:31, Scurvy Scott wrote:
One question related to the instruction aspect- does this make sense to you?

If len(sys.argv) == 0:
     print "usage: etc etc etc"


Right idea, but not quite correct.

sys.argv always includes at least one item, the name of the script being 
called. This is why you will often see code like this, to extract the actual 
arguments:


argv = sys.argv[1:]  # slice excluding the first item
if len(argv) == 0:
    usage()
else:
    main(argv)


or similar.


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

Reply via email to