Skip to content

Instantly share code, notes, and snippets.

@RHDZMOTA
Created August 22, 2021 05:36
Show Gist options
  • Save RHDZMOTA/f7f7514d89689c7b3dbc5c930cde4c1c to your computer and use it in GitHub Desktop.
Save RHDZMOTA/f7f7514d89689c7b3dbc5c930cde4c1c to your computer and use it in GitHub Desktop.
Python script: hello
import os
import argparse
from typing import Optional
DEFAULT = os.environ.get("DEFAULT", "world")
def hello(name: Optional[str] = None):
print(f"Hello, {name or DEFAULT}.")
def main():
parser = argparse.ArgumentParser()
parser.add_argument("--name", type=str, default=DEFAULT)
args = parser.parse_args()
hello(name=args.name)
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment