# default_exp core
#export
def left_pad(padded_string, padding):
"Pads string with spaces from the left so that its total width equals padding"
return padded_string.rjust(padding, ' ')
#hide
from nbdev.showdoc import *
show_doc(left_pad)
left_pad("nbdev", 10)
assert left_pad("hello", 0)=="hello"
assert left_pad("hello", 5)=="hello"
assert left_pad("hello", 6)==" hello"
from nbdev.export2html import nbdev_build_lib; nbdev_build_lib()
Converted 00_core.ipynb.
Converted index.ipynb.
from nbdev.export2html import nbdev_build_docs; nbdev_build_docs()
converting: /work/pyleftpad/00_core.ipynb
converting: /work/pyleftpad/index.ipynb
converting /work/pyleftpad/index.ipynb to README.md
#hide
!nbdev_install_git_hooks
Executing: git config --local include.path ../.gitconfig
Success: hooks are installed and repo's .gitconfig is now trusted
#hide
!git config user.name "Simon Sotak"
!git config user.email "the21st@gmail.com"
#hide
!git add *
!git commit -m "Committing our new left-pad library"
The following paths are ignored by one of your .gitignore files:
build
dist
pyleftpad.egg-info
Use -f if you really want to add them.
[master 0a95365] Committing our new left-pad library
3 files changed, 22 insertions(+), 15 deletions(-)
#hide
!git push origin master
Enumerating objects: 11, done.
Counting objects: 100% (11/11), done.
Delta compression using up to 4 threads
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 1.13 KiB | 1.13 MiB/s, done.
Total 6 (delta 5), reused 0 (delta 0)
remote: Resolving deltas: 100% (5/5), completed with 5 local objects.
To https://github.com/the21st/pyleftpad.git
3e77230..0a95365 master -> master