convert number to string in python

后端 未结 5 1555
你的背包
你的背包 2021-01-26 17:40

I meet a problem about converting number to string.

I want to get a string \"0100\" from str(0100), but what I got is \"64\". Does any way I can do to get a string \"010

5条回答
  •  春和景丽
    2021-01-26 18:17

    Not sure if I understood the question... maybe you're looking for this:

    '%04o' % 0100  # 0100
    

提交回复
热议问题