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 = {}
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