[Tutor] python - files
Cameron Simpson
cs at cskk.id.au
Sun Jan 27 04:54:13 EST 2019
On 27Jan2019 10:30, Peter Otten <__peter__ at web.de> wrote:
>Cameron Simpson wrote:
>> Mats has mentioned the modules getopt and argparse etc. These are
>> primarily aimed at option parsing ("-v", "-o foo"). Your situation
>> occurs _after_ the option parsing (in your case, there are no options).
>
>Not argparse. The main advantage over optparse is its handling of positional
>arguments.
I stand corrected.
>Your custom logic
[...]
>can roughly be replicated with the two lines
>
>parser.add_argument("first")
>parser.add_argument("second", nargs="?")
>[... extended example ...]
Thank you!
Cheers,
Cameron Simpson <cs at cskk.id.au>
More information about the Tutor
mailing list