Python’s argparse library - Easy method to accept and process command line arguments Part of Python’s standard library

import argparse
 
# ArgumentParser is an instance containing all the functions that argparse provides. All the stuff relevant to your parser is held by this
parser = argparse.ArgumentParser()
 
# Add a positional argument
parser.add_argument("echo")
 
# Runs the parser. All arguments provided are converted into objects and the argument namespace is populated with these objects
parser.parse_args()

When echo is provided as the positional argument, it acts as an argument string. In the command line, when we specify the argument for echo (it can be anything), it will grab that string and add it to the argument namespace. The same string can then be accessed through args as args.echo

print(args.echo)