I'm trying to make my python code as compact as possible. This is why I want to fill different list using a set list. To do this I need to fill that certain list based off position the variable 'i' is in the set list. Based off the position of 'i' within that list I need to add a string to it so that the results can be appended to the correct list. However after researching the .join() function etc. I cannot get it to work. (I'm a self taught programmer since I need to make a dynamic tool for my master's thesis, it may be something that I simply overlooked).
I've tried using the .join() function and I've researched other methods, the .join()) function however seems to be used mostly. This is the code I'm using now (very simplified)
List = ["a", "b", "c"]
a_list = []
b_list = []
c_list = []
for i in List:
if i == "a":
i.join("_list").append(1)
else:
i.join("_list").append(2)
print(a_list)
print(b_list)
print(c_list)
the output should simply give me:
[1]
[2]
[2]