Joy*_*Lam 1 python string whitespace syntax-checking
我正在尝试编写一个函数来检查尾随空格,但不删除空格。但我不知道该怎么做。有人可以教我吗?
谢谢
使用str.endswith:
>>> 'with trailing space '.endswith(' ')
True
>>> 'without trailing space'.endswith(' ')
False
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4426 次 |
| 最近记录: |