📜  python string trim - Python 代码示例

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

代码示例1
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()}\'')