Skip to content

Latest commit

 

History

History
27 lines (20 loc) · 609 Bytes

README.md

File metadata and controls

27 lines (20 loc) · 609 Bytes

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.