0.
- 对 list 镜像复制,a = [1, 2, 3] ⇒ [1, 2, 3, 3, 2, 1]
a*2
⇒a = [1, 2, 3, 1, 2, 3]
a.extend(reversed(a))
1. list comprehension 顺序
二层 for 循环的顺序:
[(i, j) for i in range(4) for j in range(i)] # 两个 for 循环,是从左到右进行解析的; # 也即左侧是外侧循环,越向右越表示内层循环 [(1, 0), (2, 0), (2, 1), (3, 0), (3, 1), (3, 2)]