Skip to content

Instantly share code, notes, and snippets.

@shubhamagarwal92
Last active August 12, 2019 17:30
Show Gist options
  • Save shubhamagarwal92/450df34aa497ab2c70f68492a50c16f3 to your computer and use it in GitHub Desktop.
Save shubhamagarwal92/450df34aa497ab2c70f68492a50c16f3 to your computer and use it in GitHub Desktop.
convert args from argparse to dictionary
import argparse
def parse_args():
....
return args
args = parse_args()
config = vars(args)
for arg in vars(config):
print("{:<20}: {}".format(arg, getattr(config, arg)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment