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.3.tar.gz
(3.8 kB
view hashes)
Built Distribution
Close
Hashes for smarty_left_pad-1.0.3-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2e498c83ae3524c7fcec46e941bb560e2a7213afa5a0ee0978e2c2d57302040e |
|
MD5 | 97c8b69fecaa6c0cc75df52ecbbb4dd2 |
|
BLAKE2b-256 | 4173c2359666cb8cda65a159b9d354ce003071fa887c4ddf3bd46c6eea5a0ef8 |