输入
a = list(map(int, sys.stdin.readline().split())) #将多个整数读入列表
初始化列表
1、基本方法。
lst = [1, 2, 3, 4, 5]
2、初始化连续数字。
>>> lst = [n for n in range(5, 10)]
>>> print(lst)
[5, 6, 7, 8, 9]
3、初始化n个相同值。(两种方式)
>>> 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]