Can't match str/unicode
cmpython at gmail.com
Sat Jan 7 23:33:15 EST 2017
On Saturday, January 7, 2017 at 7:59:01 PM UTC-5, Steve D'Aprano wrote:
> On Sun, 8 Jan 2017 08:40 am, CM wrote:
> > So what's going on here? Why isn't a string with the content 'match' equal
> > to another string with the content 'match'?
> You don't know that the content is 'match'. All you know is that when
> printed, it *looks like* 'match'.
> s = 'match '
> print 'match', s # they look the same
> print 'match' == s # but they aren't the same
> Start by printing repr(candidate_text) and see what you really have.
Yes, that did it. The repr of that one was, in fact:
Thanks, that did it. Do you happen to know why that /r was appended to the unicode object in this case?
More information about the Python-list