arr = [[1,2,3],[4,5,6],[7,8,9]]
In javascript:
let flatList = arr.flat()
In python, my trick is walrus operator:
flat_list = [][flat_list:=flat_list+sub for sub in arr]
Post a Comment
No comments:
Post a Comment