1

Suppose here is a list which contains dictionaries

List= [{'IP': '100.43.23.22', 'Credential': 'admin2', 'Phone number' : '99884'},

{'IP': '100.43.23.42', 'Credential': 'admin3', 'Phone number' : '99884'},

{ 'Credential': 'admin4' , 'Phone number' : '33334'},

{ 'Credential': 'admin4' , 'Phone number' : '33334'}]

Manu
  • 11
  • 1
  • 3
  • Just pass it as a JSON string – Nick is tired Aug 23 '17 at 09:33
  • What exactly do you need help with here? Python can parse strings into native dictionaries. Typically you would use `ast.literal_eval()`. See this question for details. https://stackoverflow.com/questions/3249345/python-convert-string-object-into-dictionary – Håken Lid Aug 23 '17 at 09:39
  • @HåkenLid Look at this https://stackoverflow.com/questions/45069200/passing-json-text-as-command-line-argument , similar kind but i have many dictionaries inside list so all together i should pass as the argument with name List. – Manu Aug 23 '17 at 09:47
  • I vote to reopen. The duplicate question actually doesn't have an answer to this. It instead answers how to parse json. Python dictionaries are not the same. Json does not permit single quotes for string literals. – Håken Lid Aug 23 '17 at 09:54

0 Answers0