So, the question by it's self sounds complex. I'm making a program that can read css files. Here's the full code if you want to see it ( http://pastebin.com/F09MScfp ). So I have a variable. (let's call it element) element is inside a for loop to get the styles and names. For example:
for elementName in contents.split('{'):
element = elementName.split('}')
print(element + '\n\n')
print(element)
results:
#For loop results
['#IDname', 'border:1px black solid;']
['.ClassName', 'border:3px blue solid']
#outside of loop (if global)
['IDname', 'border:1px black solid;']
So I need to be able to have an automated way of storing each list into a variable, like to call Element1 and get #IDname. Example: print(Element2)
And get this as a result
['.ClassName', 'border:1px black solid']
So I was thinking of doing a loop inside that loop like so.
i=0
for i in element:
i = 1+i
exec('globals()Element+ %i = element' %i)
#sorry, I'm still really new to python :(