Created
October 11, 2018 06:00
-
-
Save yamyamyuo/f86e7be3467a78e5858a783698fbbe91 to your computer and use it in GitHub Desktop.
python argparser
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
from argparse import ArgumentParser | |
parser = ArgumentParser() | |
parser.add_argument( | |
"--verbose", | |
help="turn on debug mode", | |
default=False, | |
action='store_true') | |
parser.add_argument( | |
"--process-lock-file", help="process file lock", required=True) | |
args = parser.parse_args() | |
logging.basicConfig( | |
level=logging.DEBUG if args.verbose else logging.INFO, | |
format= | |
'%(asctime)s pid:%(process)d %(levelname)s (%(filename)s:%(lineno)d)- %(message)s' | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment