buggy python interpretter or am I missing something here?

Dan Sommers dan at tombstonezero.net
Mon Jan 27 11:38:43 EST 2014


On Mon, 27 Jan 2014 10:23:49 -0600, Zachary Ware wrote:

>> Understood, except that some parameters take multiple elements...thus
>> why I manually reference the indexes.
> 
> Try this on for size, then:
> 
> a_iter = iter(a)
> for arg in a_iter:
>     print('current', arg)
>     if arg == '-#':
>         print('next', next(a_iter))

And check out add_argument's "nargs" option:

    http://docs.python.org/3/library/argparse.html#nargs

HTH,
Dan



More information about the Python-list mailing list