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
| import argparse | |
| # Argument parser setup | |
| parser = argparse.ArgumentParser() | |
| parser.add_argument('-i', '--input', nargs='?', type=argparse.FileType('r'), | |
| default='data.txt', help='Specify input file') | |
| parser.add_argument('-o', '--output', nargs='?', type=argparse.FileType('w'), | |
| default='out.txt', help='Specify output file') | |
| args = parser.parse_args() |
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
| import argparse | |
| import logging | |
| # Argument parser setup | |
| parser = argparse.ArgumentParser() | |
| parser.add_argument('-i', '--input', nargs='?', type=argparse.FileType('r'), | |
| default='data.txt', help='Specify input file') | |
| parser.add_argument('-o', '--output', nargs='?', type=argparse.FileType('w'), | |
| default='out.txt', help='Specify output file') | |
| parser.add_argument('-l', '--logging', choices=['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'], default='INFO', help='Set logging level') |