Created
October 4, 2017 09:25
-
-
Save tokutoku3/f2151085517d25b2e7233b2215890809 to your computer and use it in GitHub Desktop.
pythonでコマンドライン引数受け取り
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(description='Help message Zzzzzz.') | |
parser.add_argument( | |
'--param1', | |
choices=['foo', 'bar', 'baz'], | |
required=True, | |
help='Description param1' | |
) | |
parser.add_argument( | |
'--param2', | |
required=True, | |
help='Description param1' | |
) | |
args = parser.parse_args() | |
print args |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment