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 (:

Recommended Answers

All 3 Replies

Surely it is possible, but why would you not use a normal dict or object?

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

That is bad design used dict or object attributes instead.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.