Re: How does one make argparse print usage when no options areprovided on the command line?
On Wed, 5 Dec 2012 11:31:57 -0700
Ian Kelly <email@example.com> wrote:
> On Wed, Dec 5, 2012 at 9:48 AM, rh <firstname.lastname@example.org>
> > I have argparse working with one exception. I wanted the program to
> > print out usage when no command line options are given. But I only
> > came across other examples where people didn't use argparse but
> > instead printed out a separate usage statement. So they used
> > argparse for everything but the case where no command line args are
> > given.
> if len(sys.argv) <= 1:
> args = parser.parse_args()
It works in 2.7 and 3.3.
|All times are GMT. The time now is 07:15 PM.|
Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.