티스토리 뷰

공부

[python] n.zfill(3)

승가비 2023. 5. 16. 00:21
728x90
>>> n = '4'
>>> print(n.zfill(3))
004

https://stackoverflow.com/questions/339007/how-do-i-pad-a-string-with-zeroes

 

How do I pad a string with zeroes?

How do I pad a numeric string with zeroes to the left, so that the string has a specific length?

stackoverflow.com

 

728x90

'공부' 카테고리의 다른 글

[ChatGPT] DAN  (0) 2023.05.16
[ssh] ~/.ssh/config  (0) 2023.05.16
[kafka-ui] helm chart  (0) 2023.05.16
[js] sleep single thread  (0) 2023.05.16
[pypi] seunggabi_core_python  (0) 2023.05.16
댓글