5}".format(element))```Outpu"/>
当前位置:  首页>> 技术小册>> Python合辑4-130个字符串操作示例

不同长度的Python填充字符串

  1. data = [1148, 39, 365, 6, 56524]
  2. for element in data:
  3. print("{:>5}".format(element))

Output:

  1. 1148
  2. 39
  3. 365
  4. 6
  5. 56524