how does this line 2d array to 1d array conversion work?

后端 未结 0 1368
旧时难觅i
旧时难觅i 2021-01-31 14:19

I am able to get it to work but I don\'t understand how it works

li=[[0,1,2],[3,4,5],[6,7,8]]
li2 = [ y for x in li for y in x]

output: li2: [0,1

相关标签:
回答
  • 消灭零回复
提交回复
热议问题