0

What I want to do is use my variable in creating a lists name. I'm not sure if that's possible, but if it is my goal is to have it look something like this:

i = 3
asdf = ['00','34','43','61','35','64','25']
asdf + i = [] # So in this case it would be asdf3
for each in re.findall('[0-9]+', asdf):
if each == any(re.findall('[0-9]+', asdf)[i]):
asdf + i.append(each) so #asdf3 would be appended with each
else:
i = i+3
asdf + i = [] #would create a new list: asdf6

I'm not sure if I'm just being noobish or if it's not possible and I'm going to have to go about it a different way. Help is appreciated (:

2
Contributors
3
Replies
6
Views
5 Years
Discussion Span
Last Post by pyTony
0

sorry noob error there the 5th line should be:
if any(each for x in re.findall('\d+', asdf)[i]) #(it was late :P)

how would I go about doing that? I need to generate lists in my script with a name that I haven't written. Sorry if it sounds really basic I'm kind of new to it

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.