shine_hu
幼苗
共回答了12个问题采纳率:83.3% 举报
这是填充字符用的.
用法:string.ljust(s,width[,fillchar])
意思就是如果你的字符串本来长度是5,我要把它变成长度为40,而且可以用字符填充.
>>> import string
>>> s="hello"
>>> string.ljust(s,40)
'hello '
>>> string.ljust(s,40,'x')
'helloxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
1年前
8