Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Left fill with zeros

print str(1).zfill(3);
# Expected output: 001

# Since python 3.6 you can use fstring :
number = 1
string_to_print = f"padded number: {number:05}"
print(string_to_print)

>>> padded number: 00001
Source by duckduckgo.com #
 
PREVIOUS NEXT
Tagged: #Left #fill #zeros
ADD COMMENT
Topic
Name
9+8 =