0

How to create a Dict with a custom input name?

How to create a Dict with a custom input name? For Ex: foo = raw_input(">> ") >> bar Desired Output: bar = {}

18th Mar 2018, 7:37 PM
Gabriel Paz
Gabriel Paz - avatar
1 Odpowiedź
+ 3
It is a pain to use, but: name = input("Name: ") #get custom name exec(name+"={}") #initialize dictionary print(name+"=", end="") #output string print(eval(name)) #output dictionary
18th Mar 2018, 9:39 PM
John Wells
John Wells - avatar