Похожие чаты

Hello all, i have a list like this [[a1,v1],[a2,v2]....] how

can iterate in order to get only the vi element of each list?

16 ответов

10 просмотров

For each item in the list read the 2nd element

David-Mills Автор вопроса
Muflone
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?

David-Mills Автор вопроса
Muflone
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?

David Mills
that's right, i find out something wrong in my cod...

The second element in item will have your data

David-Mills Автор вопроса
Muflone
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

David-Mills Автор вопроса
Muflone
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

David Mills
i dont get it, sorry. I have something like [[a1,v...

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)

David-Mills Автор вопроса
artemetra 🇺🇦 [less active]
posted this in a different group, but this is what...

the code is right but there is something strange with my data, sorry

David-Mills Автор вопроса
Muflone
This is illogical, your data is not made in the wa...

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]]

David Mills
A=[[1624754860000.0, 251616.928272], [16253565011...

the code still works though🧐 it printed out [251616.928272, 6353738.726276]

Похожие вопросы

Обсуждают сегодня

Ясн. Но я всеравно к кедам отношусь с опасением. Чисто субьективное кедосозерцание. Что касаемо "восторга изяшности кед" так и не вкурил, хотя много слышал, пока не поставил с...
Артем Записной
30
Есть какой-нибудь для Delphi/FPC T*Compression(Decompression)Stream на базе LZ4/Zstd/любой другой быстрый(и хорошо сжимающий) алгоритм А ещё лучше в pure pascal А ещё лучше од...
notme
48
Такой вопросец - есть функция function MySuperDuperConcat(const a: array of AnsiString): AnsiString; Как мне в её теле сделать вот так? Result:=Concat(a); А не грустный вариан...
notme
15
type TObj = object procedure Init; virtual; end; TObj1 = object(TObj) procedure Init; override; end; procedure TObj1.Init; begin inherited; end; procedur...
Alexander 👋
29
А чем вам питонисты не угодили?😂
.
79
They keep hyping $FUN but where's the progress? 🙄
Noah Noure
23
Hello everyone, sorry for asking as I guess this has already been answered a thousand times but... I m a bit concerned about the FTM -> S swap. I m hodler and quiet exposed a...
Tonton ToOn
6
Btw guys very stupid question but i haven't researchd so js asking you pros . Can ltc be traced too? Literally point to pint to the user? And getting the banks blocked ? Exch...
20
Can I deposit from Bingx-exchange to wazirx? Any problem? Admin
Crypto Alt Trader
16
Hey guys, did you see the new announcement about $Fun? 🔥
Filip Murphy
55
Карта сайта