Skip to main content

A port of the infamous left-pad npm package

Project description


Left pad a string in Python. Created to try out making a pip package and uploading it to the Python Package Index (PyPI). Inspired by the left-pad package on npm which broke parts of the internet.


pip install leftpad


from leftpad import left_pad

left_pad("foo", 5)
// => "  foo"

left_pad("foobar", 6)
// => "foobar"

left_pad(1, 2, '0')
// => "01"

left_pad(17, 5, 0)
// => "00017"


Run python -m doctest

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for leftpad, version 0.1.2
Filename, size File type Python version Upload date Hashes
Filename, size leftpad-0.1.2-py3-none-any.whl (1.8 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size leftpad-0.1.2.tar.gz (1.5 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page