📜  py 变量空间填充 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:47.893000             🧑  作者: Mango

代码示例1
mystr = "peter"
width = 10
filler = '*'

print(f'Output: {mystr:{filler}<{width}}')
# -> 'Output: peter*****'

print(f'Output: {mystr:{filler}>{width}}')
# -> 'Output: *****peter'