更新时间:2023-02-26 20:39:28
如果要使用repr()
打印text
的内容,您将看到它不包含两个连续的空格:
If you were to print the contents of text
using repr()
, you will see that it does not contain two consecutive spaces:
'hello \xa0 \xa0 \xa0world '
因此,您的函数正确返回了False
.可以通过将不间断空格转换为空格来解决此问题:
As a result, your function correctly returns False
. This could be fixed by converting the non-break space into a space:
text = text.replace(u'\xa0', u' ')