A port of the infamous left-pad npm package
Project description
leftpad
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.
Install
pip install leftpad
Usage
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"
Testing
Run python -m doctest leftpad.py
.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
leftpad-0.1.2.tar.gz
(1.5 kB
view details)
Built Distribution
File details
Details for the file leftpad-0.1.2.tar.gz
.
File metadata
- Download URL: leftpad-0.1.2.tar.gz
- Upload date:
- Size: 1.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e38a2ebc18e0ce3adb4116708c9d8b0ec1d15414eafa4d236be7db893e8dc911 |
|
MD5 | 79ca60f6055970eb689daa628e99eb83 |
|
BLAKE2b-256 | 8ca4174ed26c7165bdcdc3e612c1bba756b4c2f405bef6fcee4063481a981d0d |
File details
Details for the file leftpad-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: leftpad-0.1.2-py3-none-any.whl
- Upload date:
- Size: 1.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ff2df0f8dbe6537d7f5f7cfb579b628ee81d02556971f2bb5992f6dffacc60e |
|
MD5 | e8111e485d0cb7acf625ea551fec58a3 |
|
BLAKE2b-256 | c292b15f48c2fb7c18ff0a21d77c6c1e0f3ae743b8d5b0516841cd290ec5e283 |