Jan-25-2018, 08:45 PM
Just a curious question, how would one flatten the following list
[[[2], [4, 1, 3]], [5, 7], 1, 10, [[[5, 5, 5], [4, 4, 4]]]]
?
Flattening List
|
||||||||||
Jan-25-2018, 08:45 PM
Just a curious question, how would one flatten the following list
[[[2], [4, 1, 3]], [5, 7], 1, 10, [[[5, 5, 5], [4, 4, 4]]]] ?
Jan-25-2018, 08:51 PM
I think with zip().
Jan-25-2018, 09:38 PM
(This post was last modified: Jan-25-2018, 09:38 PM by Gribouillis.)
Here is a recursive solution
Black magic:
eval is bad, you say? I know:
Jan-25-2018, 11:18 PM
Jan-25-2018, 11:25 PM
Jan-26-2018, 12:13 AM
I want to break Python 2 support
![]() yield from .
| ||||||||||
|
Possibly Related Threads… | |||||
Thread | Author | Replies | Views | Last Post | |
Flattening attribute access | ruy | 5 | 3,004 |
Jun-25-2021, 08:26 PM Last Post: ruy |
|
Problem in flattening list | Shahmadhur13 | 5 | 3,388 |
May-03-2020, 12:40 AM Last Post: DeaD_EyE |
|
flattening a list with some elements being lists | Skaperen | 17 | 10,029 |
Apr-09-2019, 07:08 AM Last Post: perfringo |