argparse
Build command-line interfaces with options, help text and validation.
Easy
import argparse
p = argparse.ArgumentParser(description="Log serial data")
p.add_argument("port"); p.add_argument("--baud", type=int, default=115200)
args = p.parse_args()
Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.
Discussion (0)
Sign in or join free to ask questions and discuss this topic.