You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

leftpad

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

leftpad

A port of the infamous left-pad npm package

0.1.2
pipPyPI
Maintainers
1

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.

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts