Discuss / Python / 笔记

笔记

Topic source

列表表达式是不是类似js里的map、filter、reduce,可以做映射,过滤、迭代。

数组转对象:

L = ['Hello', 'World', 'IBM', 'Apple']
print({i: j for i, j in enumerate(L)})

  • 1

Reply