can iterate in order to get only the vi element of each list?
For each item in the list read the 2nd element
i made this as: for list in external_list: for entry in list: print entry[1] is this right?
No, remove one for loop
that's right, i find out something wrong in my code. Starting from [[a1,v1],[a2,v2]] if i use for item in list: i got each item as [[a1,v1]] instead of a single list, why this happen?
The second element in item will have your data
yes but i have a list of list for each item instead of having a single list with 2 values
The item is a list, you told so
i dont get it, sorry. I have something like [[a1,v1],[a2,v2]....] so an external list made of sublists. If i iterate over this external list i should have that each item is a list and i should directly access it. Indeed what i got is that each item is [[a1,v1]] then [[a2,v2]] and so on
This is illogical, your data is not made in the way you refer
posted this in a different group, but this is what you need res = [] for ind in <your list name>: res.append(ind[1]) print(res)
the code is right but there is something strange with my data, sorry
send an example of data where that code breaks
A=[[1624754860000.0, 251616.928272], [1625356501100.0, 6353738.726276]] this is a part of the list i'm trying to iterate in order to get each second value of each sublist. This is what i got if i made for entry in A: print(entry) [[1624754860000.0, 251616.928272]] [[1625356501100.0, 6353738.726276]]
the code still works though🧐 it printed out [251616.928272, 6353738.726276]
Open your python and paste those lines
Обсуждают сегодня