I'm new to python, so I don't know if this is possible. I'm trying to create a list of variable names from a list of strings so I can then assign values to the newly created variables.
I saw another similar question, but there was already a dict pays of keys and values.
Here's my code:
def handy(self):
a = raw_input('How many hands? ')
for i in range(int(a)):
h = "hand" + str(i+ 1)
self.list_of_hands.append(h)
# would like to create variable names from self.list_of_hands
# something like "hand1 = self.do_something(i)"
print h
print self.list_of_hands
Given some of the answers, i'm adding the following comment: I'm going to then assign dicts to each variable. So, can I create a dictionary of dictionaries?