[Tutor] run with default value if input not given

Brian van den Broek brian.van.den.broek at gmail.com
Mon Oct 29 11:42:17 CET 2012


On 29 Oct 2012 02:30, "Saad Javed" <sbjaved at gmail.com> wrote:
>
> I've come up with this:
>
> try:
> sys.argv[1]
> x = sys.argv[1]
> main(x)
> except IndexError:
> main(x)
>
> It works but seems hackish.
>
> Saad

Saad,

The first sys.argv is not needed.

Notice how i have replied below the text i am quoting? That is the
preference of most on the list.

Best,

Brian Vdb
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20121029/e8177444/attachment.html>


More information about the Tutor mailing list