I would like to format a string with dynamically changing left zero padding depending on the value input to the string. Something like this:
value = 123 n=6 print("{value:0n}".format(value=value, n=n)) '000123'
But I can't quite get it to work.
Try str.zfill:
str.zfill
print(str(value).zfill(n))
Output:
000123
1.4m articles
1.4m replys
5 comments
57.0k users