📌  相关文章
📜  python 从字符串末尾修剪空格 - Python 代码示例

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

代码示例3
s1 = '  abc  '

print(f'String =\'{s1}\'')

print(f'After Removing Leading Whitespaces String =\'{s1.lstrip()}\'')

print(f'After Removing Trailing Whitespaces String =\'{s1.rstrip()}\'')

print(f'After Trimming Whitespaces String =\'{s1.strip()}\'')