Last active
May 11, 2016 12:34
-
-
Save dmitryhd/fc9ba9e44b68cefb376f to your computer and use it in GitHub Desktop.
Argparse sample
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
| #!/usr/bin/env python3 | |
| import argparse | |
| def parse_args(): | |
| """ Process command line arguments. """ | |
| parser = argparse.ArgumentParser() | |
| parser.add_argument("-c", "--column", type=int, | |
| default=0, | |
| help="Column to read, begins with 0. Default = 0.") | |
| parser.add_argument("-f", "--filename", type=str, | |
| default='Example.fasta', | |
| help="Filename to read. Default = Example.fasta") | |
| # choices=['rock', 'paper', 'scissors'] | |
| parser.add_argument('--version', action='version', version='%(prog)s 2.0') | |
| args = parser.parse_args() | |
| return args | |
| def main(): | |
| """ """ | |
| args = parse_args() | |
| if __name__ == '__main__': | |
| main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment