Python: Get Command Line Args

By Xah Lee. Date: .
# 2024-11-22
# print command line args
# file name: print_args.py

# example
# python print_args.py one two

import sys

print(f"script_name: {sys.argv[0]}")
print(f"first_arg: {sys.argv[1]}")
print(f"second_arg: {sys.argv[2]}")

Python, System Call Related