Skip to main content

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.4.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

smarty_left_pad-1.0.4-py2.py3-none-any.whl (7.3 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file smarty-left-pad-1.0.4.tar.gz.

File metadata

  • Download URL: smarty-left-pad-1.0.4.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.0 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.6

File hashes

Hashes for smarty-left-pad-1.0.4.tar.gz
Algorithm Hash digest
SHA256 ad76f3b1a29689846b0a86b353f242b37c7f478be1ff2d88bc1bd1cd833ab2d5
MD5 d35a744e154bc9994bf91ecfc99bdc30
BLAKE2b-256 9d1bbfe8afc72de890e5b8c5c51bc745f8ef68f2c63e9007f721dff6a3c8efe3

See more details on using hashes here.

File details

Details for the file smarty_left_pad-1.0.4-py2.py3-none-any.whl.

File metadata

  • Download URL: smarty_left_pad-1.0.4-py2.py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.0 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.6

File hashes

Hashes for smarty_left_pad-1.0.4-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 b1e548e3d397215775c9f7332e741ecb2c92f3eada1dfd6521f1bdee5d1f525e
MD5 d97e858584a3136876ec375bb0697f7c
BLAKE2b-256 38c5305101676cdcf5484cbee6f774489e0971e301fe69999550d78c344e2f60

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