Created
August 24, 2018 16:27
-
-
Save danielpsf/43fb359ef63d607cb5f2e01fb7b1b51c to your computer and use it in GitHub Desktop.
Simple way of using multiple parameters in Python using argparse
This file contains 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 argparse | |
parser = argparse.ArgumentParser() | |
parser.add_argument( | |
'--potatoes', '-p', | |
nargs='*', | |
type=str, | |
required=True, | |
help='Type of potatoes that you like most' | |
) | |
args = parser.parse_args() | |
print('I think you said you like:') | |
for potato in args.potatoes: | |
print('- {}'.format(potato)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment