On 04/01/2013 10:34 PM, Mark Lawrence wrote:
On 02/04/2013 02:37, Dave Angel wrote:
On 04/01/2013 09:31 PM, Mark Lawrence wrote:

for a in vars(parser.parse_args()):
     print('This arg is %s' % a)

http://docs.python.org/3/library/argparse.html#the-namespace-object

Please don't ask me for an explanation as it took me long enough to work
this out from the docs :)


http://docs.python.org/2/library/argparse.html

     see section 15.4.4.6 for a very brief explanation of vars()



Section 15.4.4.6. The Namespace object, but I can't for the life of me
remember what my link referred to :)


Whoops, sorry. I didn't notice your link was equivalent to (better than) mine. I had worked it out before your message showed up, then abandoned all of my message except for the link.

BTW, can you tell me how you get the #the-namespace-object part of your link? Is there some technique (without actually looking in the source code for the page) for finding the nearest id= ? I've now figured out how to do it for pages like this one with a TOC, but is there a more general way?

For others like me:
If there's a TOC (table of contents) for a page, you can right-click on the link to the particular section of the page, and COPY it to the clipboard. It'll then have the form like:
  http://docs.python.org/3/library/argparse.html#the-namespace-object

where the last field specifies the particular section of the page desired.



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

Reply via email to