I have a nested list like this:
list1 = [1,2,3]
list2 = [4,5,6]
list_all = [list1,list2]
My question is in a for loop how to get the list1 and list2 as a name of the list:
for i in list_all:
print(list1.name,list2.name)
Output should like:
"list1",'list2'
list_allis exactly equivalent to[[1,2,3],[4,5,6]]- there is absolutely no way to tell that the sub-lists came from individual variables, rather than being written directly in the assignment.