import string for x in xrange(1,10): for y in xrange(1,x+1): print string.ljust("%d*%d = " %(y,x) + str(y*x), 10), print
输出结果: