left fill with zeros

Solutions on MaxInterview for left fill with zeros by the best coders in the world

showing results for - "left fill with zeros"
Romeo
02 Sep 2017
1print str(1).zfill(3);
2# Expected output: 001
3
4# Since python 3.6 you can use fstring :
5number = 1
6string_to_print = f"padded number: {number:05}"
7print(string_to_print)
8
9>>> padded number: 00001
queries leading to this page
zero fill left shiftleft fill with zeros