Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

Pad a string to the left with any number of characters

Project description

Pad a string to the left with any number of characters

pip install left-pad

Then

>>> from left_pad import left_pad
>>> s = "abc"
>>> left_pad(s, 2, "+")
'++abc'

Make sure to add left-pad to your dependencies in your next project.

Or, if you want to reinvent the wheel, go ahead and try to do it with the standard library

>>> s.rjust(len(s) + 2, '+')
'++abc'

Project details


Release history Release notifications

Download files

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

Files for left-pad, version 0.0.3
Filename, size File type Python version Upload date Hashes
Filename, size left-pad-0.0.3.tar.gz (1.1 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page