>>> import sys
>>> mat = []
>>>
>>> while 1:
... try:
... line = sys.stdin.readline().split()
... row = list(map(int, line)) # [1, 2, 3]
... mat.append(row) # 形成矩阵
... print(mat)
... except EOFError:
... print('break')
... break
...
1 2 3
[[1, 2, 3]]
4 5 6
[[1, 2, 3], [4, 5, 6]]
7 8 9
[[1, 2, 3], [4, 5, 6], [7, 8, 9]]
[[1, 2, 3], [4, 5, 6], [7, 8, 9], []]
Traceback (most recent call last):
File "<stdin>", line 6, in <module>
KeyboardInterrupt
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…