Created
June 18, 2021 00:24
-
-
Save slashtechno/2e4235861436529b84c25c6d9731a457 to your computer and use it in GitHub Desktop.
accept cli arguments in Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/python3 | |
import argparse | |
cli_options = argparse.ArgumentParser() | |
cli_options.add_argument("--hello") | |
cli_options.add_argument("--world") | |
args = cli_options.parse_args() | |
host=args.host | |
port=args.port | |
print(host) | |
print(port) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment