字符串zfill()函数,右对齐,左边填充0

例如:

i = 12
s = str(i).zfill(4)
print(s)   # 输出:0012

 

posted @ 2023-07-10 10:06  Picassooo  阅读(40)  评论(0)    收藏  举报