开发者

python string differences

I am seeing that a string comparison of two identical strings ('fraiser') in Python is failing. When using repr(str1) and repr(str2) I get different results, but I don't know how to interpret them or why they return different things. Any help?

>>> repr(list(lowerAndMakeSet(fileChunks))[3])

"'frasier'"


>>> repr开发者_如何学Go(list(lowerAndMakeSet(c))[2])

"['f', 'r', 'a', 'i', 's', 'e', 'r']"


Your second "string" that you are repring is actually a list and not a string. You can see this if you do type(list(lowerAndMakeSet(c))[2]).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜