小册名称:Python合辑4-130个字符串操作示例
在Python中将整数格式化为带有前导零的字符串
x = 4x = str(x).zfill(5)print(x)
x = 4
x = str(x).zfill(5)
print(x)
Output:
00004