[Tutor] Argparse and how best to use it

Mark Lawrence breamoreboy at yahoo.co.uk
Thu Oct 24 19:03:42 CEST 2013


On 24/10/2013 16:38, Paradox wrote:
> I am trying to learn about argparse and how best to incorporate it into
> my scripts.  I am using Python 2.7.5 on Ubuntu 13.10.
>
> It seems from the argparse tutorial that all the arguments are processed
> as global variables.  Is that the standard way to do it or do you
> normally (when doing real projects and not writing tutorials) process
> the arguments in the main loop of the script?
>
> thomas
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>

You can save yourself much pain by using the third party docopt, it's 
absolutely awesome.  Download from here https://pypi.python.org/pypi/docopt/

-- 
Python is the second best programming language in the world.
But the best has yet to be invented.  Christian Tismer

Mark Lawrence



More information about the Tutor mailing list