0

我正在尝试编写一个函数来检查尾随空格,但不删除空格。但我不知道该怎么做。有人可以教我吗?

谢谢你

4

1 回答 1

4

使用str.endswith

>>> 'with trailing space  '.endswith(' ')
True
>>> 'without trailing space'.endswith(' ')
False
于 2014-10-26T03:57:21.337 回答