python 键盘输入矩阵

import numpy as np
m = int((input("请输入行数"))
res=[]
for i in range(m):
	ans=[int(j) for j in input('输入:').split()]
	res.append(ans)
print('输出:',res)

参考:(3条消息) python 从键盘获取数据(整数、列表、矩阵)_啦啦啦(●'◡'●)的博客-CSDN博客_python从键盘获取列表

猜你喜欢

转载自blog.csdn.net/m0_60461719/article/details/127233759