Posted in Python onFebruary 07, 2014
from StringHelper import PadLeft for x in range(1,10): for y in range (1,x+1): endflag=' | \n' if x==y else ' | ' print(y,'*',x,'=',PadLeft( str(x*y),2,' '),end=endflag)
StringHelper.py
# -*- coding: utf8 -*- ''' 扩展为C#中的String.PadLeft ''' def PadLeft(str, num, padstr): stringlength = len(str) n = num - stringlength if n >= 0: str = padstr*n + str return str
效果图:
python3.3实现乘法表示例
声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
Reply on: @reply_date@
@reply_contents@