[issue13427] string comparison with ==

Alan report at bugs.python.org
Fri Nov 18 13:57:17 CET 2011


Alan <alan.beccati at gmail.com> added the comment:

Using repr highlights the issue which lies in the behaviour of str.strip() which does not strip away null spaces as I would have expected:

' 'utm10\x00' ' == ' 'utm10' '
not equal

Changing the code to:
currColl=line.split(":")[1].strip().strip("\0")

works but I think strip() should already do that by default, shouldn't it?

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13427>
_______________________________________


More information about the Python-bugs-list mailing list