String comparison problem

Jeff Epler jepler at unpythonic.net
Wed Apr 7 09:02:54 EDT 2004


You should use "repr" to see the exact byte sequence contained in the
strings.

If the strings really contain the same sequence of bytes, then they are
equal.  There must be some difference between them that is
non-printable.

>>> s1 = "01b7ebfc27437a90cc421c50df8f9ac5"
>>> s2 = "01b7ebfc27437a90cc421c50df8f9ac5"
>>> s1 == s2
1

But what you'll actually find is that this statement
> 	print string.lower(md5sum(f_md5))
will print a different value the first and second times you execute it.

Jeff




More information about the Python-list mailing list