如題,小弟一直很納悶,到底要如何用while迴圈讀入多組測資RRRRRR (崩潰...)
以下是我的python程式碼
import sys
while True:
a = []
res = ""
a = sys.stdin.read().split()
if len(a):
row = int(a[0])
col = int(a[1])
a.pop(0)
a.pop(0)
for i in range(0,col):
for j in range(i,(i+col*(row-1))+1,col):
res += a[j] + " "
res = res[:-1]
res += "\n"
print(res)
else:
break