python-读取多行输入

原创
2023/04/21 18:44
阅读数 97

 input:

4 3 2
1 2
1 2 
1 2
1 2
3 4
3 4
3 4
#读取一个数组
n, m = map(int, input().split()) # taking number of rows and column
array = numpy.array([input().strip().split() for _ in range(n)], int)

#读取两个数组

x=[]
while True: 
    try:
        line = input()
        if not line: # If line is blank 
            break
        else: 
            x.append(list(map(int,line.strip().split(' '))))
    except EOFError:
        break
        

a=np.array(x[1:x[0][0]+1],dtype=int)
b=np.array(x[x[0][0]+1:x[0][0]+x[0][1]+1],dtype=int)

 

展开阅读全文
加载中
点击引领话题📣 发布并加入讨论🔥
0 评论
0 收藏
0
分享
返回顶部
顶部