Skip to content

Console/GUI scripts with command-line arguments #3352

Answered by abravalheri
codeandfire asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @codeandfire, your code should have access to sys.argv, that is the standard way of passing command line arguments.

The command practice however is to use a library to construct an interface for this.

If you want to stick with the standard library, you can try argparse.
There is a tutorial here and a minimal example here.

It is very common to see people also using click and typer instead of argparse.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@codeandfire
Comment options

codeandfire Jun 9, 2022
Collaborator Author

@abravalheri
Comment options

Answer selected by codeandfire
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants