打造一个000-999的字典

for i in range(1000):
    if i<10:
        i = '00'+str(i)
    elif 10<=i and i<100:
        i ='0'+str(i)
    else:
        i=str(i)
    with open('1.txt', 'a') as f:
        f.write(i+"\n")

 

相关文章:

  • 2022-12-23
  • 2021-07-22
  • 2021-10-10
  • 2022-01-19
  • 2023-01-28
  • 2021-06-16
  • 2022-12-23
  • 2022-01-16
猜你喜欢
  • 2022-12-23
  • 2021-06-29
  • 2021-12-03
相关资源
相似解决方案