Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #41948

Re: problem with sys import argv

Date 2013-03-26 16:48 -0400
From Dave Angel <davea@davea.name>
Subject Re: problem with sys import argv
References <A33EC90F-DEC4-424D-BDBF-68165669A336@icloud.com> <mailman.3764.1364320531.2939.python-list@python.org> <7378582.EtEbenrJl9@PointedEars.de>
Newsgroups comp.lang.python
Message-ID <mailman.3773.1364330936.2939.python-list@python.org> (permalink)

Show all headers | View raw


On 03/26/2013 04:12 PM, Thomas 'PointedEars' Lahn wrote:
> Dave Angel wrote:
>
>> Since the script takes a mandatory argument, run it with one.
>>
>> python  myscript.py  Dave
>>
>> Better would be to change the script to check len(argv) for exactly 2,
>> and tell the user how he should have run it.
>
> I would use argparse.ArgumentParser instead.
>
> <http://docs.python.org/dev/library/argparse.html>
>

As would I.  But that would be out of proportion of the rest of the 
code, and therefore presumably beyond the needs or interest of the OP.

-- 
DaveA

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Re: problem with sys import argv Dave Angel <davea@davea.name> - 2013-03-26 13:55 -0400
  Re: problem with sys import argv Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-03-26 21:12 +0100
    Re: problem with sys import argv Dave Angel <davea@davea.name> - 2013-03-26 16:48 -0400

csiph-web