0

I am having trouble passing a dictionary in the argparse in python. I have tried many solutions including the json.loads but nothing is working. After passing the dictionary in argparse I want to use it as a parameter in a class method. It has become a nightmare of mine now.

Thank you in advance!!

ANA
  • 83
  • 5
  • Where is the code for your current attempt? What didn't work with using `json`? – jordanm Apr 24 '20 at 15:43
  • We can't help without seeing what you tried and how it went wrong. – John Gordon Apr 24 '20 at 15:43
  • Where is the dictionary and your code? considering passing the name of a file via argparse and load the dict into your code using `json`. – Pedro Lobito Apr 24 '20 at 15:43
  • Keep your parser simple, and do any 'dictionary' decoding after parsing. Also look at `sys.argv[1:]`, the list of strings that the parser sees. Beware that the shell might mangle your input if not adequately quoted. – hpaulj Apr 24 '20 at 16:19

0 Answers0