Top "Argparse" questions

A Python module for implementing command-line interfaces

How to use python argparse with args other than sys.argv?

I've been all over the documentation and it seems like there's no way to do it, but: Is there a …

python argparse argv
Default sub-command, or handling no sub-command with argparse

How can I have a default sub-command, or handle the case where no sub-command is given using argparse? import argparse …

python parsing command-line-arguments argparse subcommand
argparse subparser monolithic help output

My argparse has only 3 flags (store_true) on the top level, everything else is handled through subparsers. When I run …

python argparse
argparse argument order

I have a little problem. I use argparse to parse my arguments, and it's working very well. To have the …

python arguments argparse keyword-argument
argparse optional subparser (for --version)

I have the following code (using Python 2.7): # shared command line options, like --version or --verbose parser_shared = argparse.ArgumentParser(add_…

python command-line-interface argparse subcommand
Python Command Line Arguments: Calling a function

So I'm stuck on a project I'm working on that involves the command line in python. So basically, here's what …

python command-line command-line-arguments argparse optparse
Python Argparse: Issue with optional arguments which are negative numbers

I'm having a small issue with argparse. I have an option xlim which is the xrange of a plot. I …

python argparse negative-number
How can I require my python script's argument to be a float between 0.0-1.0 using argparse?

I'd like to use argparse on Python 2.7 to require that one of my script's parameters be between the range of 0.0 …

python range command-line-arguments argparse
Python argparse: name parameters

I'm writing a program that use argparse, for parsing some arguments that I need. for now I have this: parser.…

python argparse
Control formatting of the argparse help argument list?

import argparse parser = argparse.ArgumentParser(prog='tool') args = [('-u', '--upf', 'ref. upf', dict(required='True')), ('-s', '--skew', 'ref. skew', {}), ('-m', …

python argparse