rks that way.
I'll do this way.
Thank a lot.
Ben
Le Jul 31, 2012 à 3:04 PM, Oscar Benjamin a écrit :
>
>
> On 31 July 2012 13:51, Benoist Laurent wrote:
>
> Le Jul 31, 2012 à 1:45 PM, Oscar Benjamin a écrit :
>
>>
>>
>> On 31 July 2012 12:03, Benoist L
Le Jul 31, 2012 à 1:45 PM, Oscar Benjamin a écrit :
>
>
> On 31 July 2012 12:03, Benoist Laurent wrote:
> Finally.
>
> The code I proposed doesn't work in this case: if you add any positional
> argument to one of the subparsers, then the parsing doesn't work
d choice: '10' (choose from 'foo',
'bar')
Any solution?
Cheers,
Ben
Le Jul 31, 2012 à 12:37 PM, Benoist Laurent a écrit :
> Really sorry about that.
>
> So, for the community, below is the full code for a tool that behaves like a
> Unix standard tool
else:
for fname in args.fname:
with(open(fname, "rt")) as f:
content = f.read()
# do somet
Benoist
Le Jul 31, 2012 à 11:55 AM, Oscar Benjamin a écrit :
>
> On Jul 31, 2012 10:32 AM, "Benoist Laurent" wrote:
&
2
bar.txt:42
$ cat foo.txt | grep 42
42
$ grep -c 42 foo.txt
1
Cheers,
Ben
Le Jul 27, 2012 à 7:08 PM, Benoist Laurent a écrit :
>
>
> Yes basically looks like you get it.
> I have to further test it but my first impression is that it's correct.
>
> So actually t
Yes basically looks like you get it.
I have to further test it but my first impression is that it's correct.
So actually the point was to use nargs="?".
Thank you very much.
Ben
Le Jul 27, 2012 à 5:44 PM, Peter Otten a écrit :
> Benoist Laurent wrote:
>
>> I
Le Jul 27, 2012 à 4:43 PM, Oscar Benjamin a écrit :
>
>
> On 27 July 2012 15:26, Benoist Laurent wrote:
> Hi,
>
> I'm impletting a tool in Python.
> I'd like this tool to behave like a standard unix tool, as grep for exemple.
> I chose to use the argparse mo
Hi,
I'm impletting a tool in Python.
I'd like this tool to behave like a standard unix tool, as grep for exemple.
I chose to use the argparse module to parse the command line and I think I'm
getting into several limitations of this module.
> First Question.
How can I configure the the ArgumentPa