import sys def hello(name): msg = name + '!!!!' print('Hello ' + msg) def main(): hello(sys.argv[1]) main()
Run as python argv.py Foo
Later we'll see the argparse module that can handle command line arguments in a better way.
Command line arguments and main
import sys def hello(name): msg = name + '!!!!' print('Hello ' + msg) def main(): hello(sys.argv[1]) main()
Run as python argv.py Foo
Later we'll see the argparse module that can handle command line arguments in a better way.