This is my first question here. I started learning python a few days ago and i have a problem.
I made some python files that each of them runs a for loop and appends the results to a list. So each file has its own list.
For example file1.py produces list1, and file2.py produces list2 etc...
My goal, is to combine all these lists together, so i am making a separate "main.py" file and import the list names and then combine them together like this:
from file1 import list1
from file2 import list2
from file3 import list3
combined_lists = [*list1, *list2, *list3]
and that is working fine as expected.
But the problem is that this method is very slow, because it is importing the lists one by one in serial in the order i have them imported.
For example, when i run it, it is importing first the list1 and when the list1 is completed it starts the list2 and then the list3 etc.. and finally combines them together.
So, because i have 400 lists on 400 different files, this is taking a very long time.
Is there any way to import and combine all the lists together in parallel?
Like with multi-threading or any other method?
Note, that i don't care about the order of the items in the combined list.