martes, 16 de julio de 2024

converting a nested list ain a singel list

>>> nested_list

[[1, 2, 3], [4, 5, 6], [7, 8, 9]]

 

>>> list=[]

>>> for  m in nested_list:

...    for t in m:

...       list.append(t)

... 

>>> list

[1, 2, 3, 4, 5, 6, 7, 8, 9]

>>> 

>>> 


>>> 


No hay comentarios:

Publicar un comentario