更新时间:2023-11-29 07:55:10
这只是表达 list
的一种更短的方式.
It's just a shorter way of expressing a list
.
li = [row[index] for row in outer_list]
相当于:
li = []
for row in outer_list:
li.append(row[index])
一旦你习惯了语法,它就会成为一种创建list
(和其他可迭代对象)的整洁方式.
Once you get used to the syntax, it becomes a tidy way of creating list
s (and other iterables).