della0887 发表于 2017-5-4 10:57:10

Python菜谱-对齐字符串

编程中经常需要对齐字符串:left,right,center
  


print '|', 'hej'.ljust(20), '|', 'hej'.rjust(20), '|', 'hej'.center(20), '|'
| hej             |             hej |       hej       |
页: [1]
查看完整版本: Python菜谱-对齐字符串