[Tutor] argparse: how to use the returned Namespace object?
Walter Prins
wprins at gmail.com
Fri Nov 5 01:17:01 CET 2010
On 4 November 2010 23:20, Mac Ryan <quasipedia at gmail.com> wrote:
> My question boils down to: how can I expand the Namespace object in
> order to get a list of keyword arguments?
>
If "ns" is your Namespace object, then use ns.__dict__, which you can
directly pass to your commands, e.g.
do_stuff(**ns.__dict__)
I'll post a more complete answer if this isn't clear/obvious.
HTH
Walter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20101105/aae85515/attachment.html>
More information about the Tutor
mailing list