str.ljust(width[,])函数,width是宽度,fillchar是可选参数,要填充的字符串。

 

str = 'lbw'
  print(str.ljust(10,'0'))

  输出结果:lbw0000000