Python String zfill() Method

Fills the string with a specified number of 0 values at the beginning

Syntax

Python
string.zfill(number)

Parameters

ParameterDescription
number Required. The length of the string to be created

Example

Python
print('123'.zfill(10))

Output

0000000123