1
ls = [0 for _ in range(10)]
print(ls)
输出为,
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
2
ls = [False for _ in range(10)]
print(ls)
输出为,
[False, False, False, False, False, False, False, False, False, False]
3
ls = [[0, 0, 0] for _ in range(10)]
print(ls)
输出为,
[[0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0]]