subcommand

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

Default sub-command, or handling no sub-command with argparse Question: How can I have a default sub-command, or handle the case where no sub-command is given using argparse? import argparse a = argparse.ArgumentParser() b = a.add_subparsers() b.add_parser(‘hi’) a.parse_args() Here I’d like a command to be selected, or the arguments to be handled based only on the …

Total answers: 10