Skip to content

Instantly share code, notes, and snippets.

@slashtechno
Created June 18, 2021 00:24
Show Gist options
  • Save slashtechno/2e4235861436529b84c25c6d9731a457 to your computer and use it in GitHub Desktop.
Save slashtechno/2e4235861436529b84c25c6d9731a457 to your computer and use it in GitHub Desktop.
accept cli arguments in Python
#!/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