Skip to main content

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


Download files

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

Source Distribution

left-pad-0.0.3.tar.gz (1.1 kB view details)

Uploaded Source

File details

Details for the file left-pad-0.0.3.tar.gz.

File metadata

  • Download URL: left-pad-0.0.3.tar.gz
  • Upload date:
  • Size: 1.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for left-pad-0.0.3.tar.gz
Algorithm Hash digest
SHA256 b842b81fcf157ca09b1e0036c5876295fdfd097640aa85d37f988857eec64654
MD5 91d24f0309ed579926d760ecca71eefd
BLAKE2b-256 a034cd668981dc6818d8a39f1185af8113268ddc71d99b0ba4aa8ceee2a123e7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page