m = 3n = 6for i in range(1, m+1): # 算出有几列 for a in range(1,n+1): # 每列有多少位 print(("{}".format((i-1)*n+a)),end=" ") print()