Published
- 1 min read
f string add 0 before python
The solution for this is noted below
f string add 0 before python
Solution
import random
for i in [25,300,478,2,1000]:
print(f"{i:04d}")
# output: 0025 0300 0478 0002 1000
Try other methods by searching on the site. That is if this doesn’t work