📜  确保字符串长度 2 python 代码示例

📅  最后修改于: 2022-03-11 14:46:19.935000             🧑  作者: Mango

代码示例1
month = "02"
month.zfill(2) #this will return "02" as it mantains the length of the string

month = "2"
month.zfill(2) # this will add the "0" before the "2" ensuring length == 2