Skip to content

Home

Pad number

Pads a given number to the specified length.

def pad_number(n, l):
  return str(n).zfill(l)

pad_number(1234, 6); # '001234'

More like this

Start typing a keyphrase to see matching snippets.