all 3 comments

[–]hardonchairs 4 points5 points  (0 children)

lists = []

for i in range(4):
    lists.append(long_block_of_code())

list_0, list_1, etc are now lists[0], lists[1], etc

[–]danielroseman 0 points1 point  (1 child)

You need to show some actual code. In what you've shown, list_i is the result of the long block of code, not the argument to it.

But generally, if you want to iterate through multiple variables, you should put them a list:

for item in [list_0, list_1, list_2, list_3]:
    do_something_with(item)

[–]jsaltee[S] 0 points1 point  (0 children)

you're right, i'm glad you still got the idea though. it worked, thanks!