left-pad的Python项目详细描述
用任意数量的字符向左填充字符串
pip install left-pad
然后
>>> from left_pad import left_pad
>>> s = "abc"
>>> left_pad(s, 2, "+")
'++abc'
确保在下一个项目中将左焊盘添加到依赖项中。
或者,如果你想重新发明轮子,那就试着去做吧
使用标准库
>>> s.rjust(len(s) + 2, '+')
'++abc'
欢迎加入QQ群-->: 979659372
推荐PyPI第三方库