import re import time
f = open("aaaa.txt") for line in f:
line = line.strip() # print line if len(line) > 6: pass elif not (re.match("\d", line)): pass elif len(line) < 6:
a = len(line)
b = 6 c = b - a
d = '0' * c
e = d + line print e else: print line
zhao
python 批量给数字前面补0
猜你喜欢
转载自blog.csdn.net/zhaoyangjian724/article/details/81748275
今日推荐
周排行