i = 1 while i<10 : j = 1 while j <= i: print("%d*%d=%-2d"%(i,j,i*j),end="") j+=1 print("\n") i+=1
ps:其中%-2d是指数据最少占了2位且靠左边显示