Created
August 22, 2021 05:36
-
-
Save RHDZMOTA/f7f7514d89689c7b3dbc5c930cde4c1c to your computer and use it in GitHub Desktop.
Python script: hello
This file contains hidden or 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
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