Skip to content

Commit 010f9a2

Browse files
committed
version
1 parent 56bc563 commit 010f9a2

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

01_hello/hello07_get_args.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env python3
2+
# Purpose: Say hello
3+
4+
import argparse
5+
6+
def get_args():
7+
parser = argparse.ArgumentParser(description='Say hello')
8+
parser.add_argument('-n', '--name', default='World', help='Name to greet')
9+
return parser.parse_args()
10+
11+
def main():
12+
args = get_args()
13+
print('Hello, ' + args.name + '!')
14+
15+
if __name__ == '__main__':
16+
main()

0 commit comments

Comments
 (0)