I want to create as many empty lists as there are integers in lst (a list of integers) and add those integers in lst to the end of each variable assigned to each empty list:
def create_3C_object_lists( lst ):
""" creates all necessary lists """
for i in range(len(lst)):
exec("globals()['_3C_%d'] = []" % (lst[i]))
print(type(_3C_%d)) % (lst[i])
What I hope to get:
_3C_(integer at index 0 in lst)
_3C_(integer at index 1 in lst)
...
and so on. Is there a better way of doing this? Perhaps without "exec" ?