Dynamic left pad creator
Project description
Left-pad for Python
Installation:
pip install smarty-left-pad
Usage
from smarty_left_pad.left_pad import left_pad
>>>left_pad('input', 10, '-')
-----input
This package uses doctest for testing, run :code:doctest left_pad.py
to run the tests.
Example of run log:
(personal386) $ pwd
/smarty-left-pad/pad_on_left
(personal386) $ python -m doctest left_pad.py -v
Trying:
left_pad('foo', 5)
Expecting:
' foo'
ok
Trying:
left_pad('foobar', 6)
Expecting:
'foobar'
ok
Trying:
left_pad('toolong', 2)
Expecting:
'toolong'
ok
Trying:
left_pad(1, 2, '0')
Expecting:
'01'
ok
Trying:
left_pad(17, 5, 0)
Expecting:
'00017'
ok
1 items had no tests:
left_pad
1 items passed all tests:
5 tests in left_pad.left_pad
5 tests in 2 items.
5 passed and 0 failed.
Test passed.
(personal386) $
In case of a failure:
Failed example:
left_pad('foo', 5)
Expected:
' fooN'
Got:
' foo'
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
smarty-left-pad-1.0.2.tar.gz
(3.9 kB
view hashes)
Built Distribution
Close
Hashes for smarty_left_pad-1.0.2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3ef72478a709f3ec7fe756c2d74a1a8c83e8555800040fa42cde7428c2ee33a1 |
|
MD5 | ad2320faf85abb03e676ef1b1f0ae121 |
|
BLAKE2b-256 | 89d9e91876fb35ff7e1f5fa2805f4b901e8115b55de14578eadc6da7703f3773 |