小册名称:Python合辑4-130个字符串操作示例
使用指定字符居中对齐字符串
txt = "canada"x = txt.center(20)print(x)
txt = "canada"
x = txt.center(20)
print(x)
Output:
canada