python字符串的ljust方法返回一个与原字符串左对齐,并使用 fillchar 填充至长度 width 的新字符串,fillchar 默认为空格,如果指定的长度小于原字符串的长度,则返回原字符串。
方法定义
def ljust(self, width, fillchar=None):
    pass
示例代码
word = 'python'
print(word.ljust(9, '*'))   # python***
            扫描关注, 与我技术互动
QQ交流群: 211426309
                        分享日常研究的python技术和遇到的问题及解决方案