Is it possible to associate multiple flags with a single dash in argparse as in this standard Linux argument style?
 tar -xvf some_filename.tar
                This will do the trick. Most likely, you didn't include the short form for each argument.
import argparse
parser = argparse.ArgumentParser(description='... saves many files together...')
parser.add_argument('--extract', '-x',
                    action='store_true',
                    help='extract files from an archive')
parser.add_argument('--verbose', '-v',
                    action='store_true',
                    help='verbosely list files processed')
parser.add_argument('--file', '-f',
                    # dest='file', -- only needed if the long form isn't first
                    help='use archive file or device ARCHIVE')
args = parser.parse_args()
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With