python初始化定长列表
>>> lst = ['x' for n in range(5)] >>> print(lst) ['x', 'x', 'x', 'x', 'x'] >>> lst = ['z']*5 >>> print(lst) ['z', 'z', 'z', 'z', 'z'] >>> lst = [0]*3 >>> print(lst) [0, 0, 0]
>>> lst = ['x' for n in range(5)] >>> print(lst) ['x', 'x', 'x', 'x', 'x'] >>> lst = ['z']*5 >>> print(lst) ['z', 'z', 'z', 'z', 'z'] >>> lst = [0]*3 >>> print(lst) [0, 0, 0]