输入
2 4
1 2 3 4
1 0
2 1
2 3
我需要从第三行到末尾提取数字对(仅从第三行提取2个数字)
这是我的函数
def read_nodes():
n, r = map(int, input().split())
n_list = []
for i in range(2 , n):
n1, n2 = map(int, input().split())
n_list.append([n1, n2])
return n_list
print(read_nodes())
我期望的输入是[[1,0],[2,1],[2,3]]
但是提示
ValueError: too many values to unpack (expected 2)
2
开始索引并不改变这个事实。 - Kendas