命令行 Command line
main.py
import sys
print(sys.argv)
python mainpy beau 39
# echo: ["main.py", "beau", "39"]
build command
main.py
import argparse
parser = argparse.ArgumentParser(description="This program prints the name of my dogs")
parser.add_argument("-c", "--color", metavar="color", required=True, choices={"red", "yellow"}, help="the color to search for")
args = parse.parse_args()
print(args.color)