Help me debug this script with argparse and if statements
rosuav at gmail.com
Thu Feb 21 12:10:42 CET 2013
On Thu, Feb 21, 2013 at 9:56 PM, Santosh Kumar <sntshkmr60 at gmail.com> wrote:
>> To do what you're looking for there, I wouldn't bother with argparse
>> at all - I'd just look at sys.argv for the word you're looking for.
>> Yes, it'd be a bit strict and simplistic, but by the look of things,
>> you don't need sophistication.
> You are right, but I think sys.argv is very basic. Before argparse
> even I was using it, but it was very hard to manage if user has less
> argument, more argument or more argument. I think argparse is the
> better thing than sys.argv, and I believe there might be any way to
> tackle my (argparse) problem. That is what I am looking here for.
Sure. In the actual example posted, I wouldn't bother, but it's like
migrating a script from bash to a more maintainable language - it's
something to think about as soon as the script gets over about a page
More information about the Python-list