🔵 🔵 🔵


Primary

၊၊||၊|။

str.zfill() ⚬|Documentation|1st|20251021115011-00-⌔

Built-in Types — Python 3 documentation#str.zfill

str.zfill(width,/)

Return a copy of the string left filled with ASCII '0' digits to make a string of length width. A leading sign prefix ('+'/'-') is handled by inserting the padding after the sign character rather than before. The original string is returned if width is less than or equal to len(s).

For example:

>>> "42".zfill(5)
'00042'
>>> "-42".zfill(5)
'-0042'

See also rjust().

Printed 2026-06-28.

(echo:: @ )

Link to original

Secondary

• • •