Skip to content

Instantly share code, notes, and snippets.

@lesserfish
Created August 28, 2025 03:25
Show Gist options
  • Select an option

  • Save lesserfish/fb18003e257097948d1ba2ae7d9930fd to your computer and use it in GitHub Desktop.

Select an option

Save lesserfish/fb18003e257097948d1ba2ae7d9930fd to your computer and use it in GitHub Desktop.
Argparse demo
import argparse
# Create the parser
parser = argparse.ArgumentParser(description='A simple demo of argparse')
# Add arguments
parser.add_argument('-i', '--input', help='You should know what this does, jackass!')
parser.add_argument('-m', '--mask', help='The mask of the file')
parser.add_argument('-o', '--output', help='The output file, my brother', default = "DEFAULT")
parser.add_argument('--method', help='The output file, my brother', required = True)
# Parse the arguments
args = parser.parse_args()
# Use the arguments
print("The input file is {}".format(args.input))
print("The output file is {}".format(args.output))
print("The mask file is {}".format(args.mask))
print("The method file is {}".format(args.method))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment