1 数字前面补零n = 123 n = "%04d" % n print n 0123 2 字符串前面补零str = "123" str = str.zfill(5) print str 00123.
確定! 回上一頁