有的时候想生成连续的数字字符串,但是生成数字的时候前面没有补上0 用下面这个方法就可以补0了 i = str(i) i = i.zfill(4) for i in range(10): print(str(i