Skip to content

Instantly share code, notes, and snippets.

@yamyamyuo
Created October 11, 2018 06:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yamyamyuo/f86e7be3467a78e5858a783698fbbe91 to your computer and use it in GitHub Desktop.
Save yamyamyuo/f86e7be3467a78e5858a783698fbbe91 to your computer and use it in GitHub Desktop.
python argparser
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