#Aren’t word and key equal? Why not perform the print operation and jump directly to the superposition of i?
代言2017-06-30 09:56:18
You can’t tell the reason just by taking screenshots of these contents.
You can add a print in else, firstly to see if else is entered, but also to see what the word and key are.
習慣沉默2017-06-30 09:56:18
What you see in the debuger
of IDE
may not be the real values. You can print out their type and have a look.
You will find that debuger
can sometimes lie.
Also, you can look at the difference between __str__
and __repr__
and understand obj==eval(repr(obj))
.
Here’s a great answer: Difference between str and repr in Python
曾经蜡笔没有小新2017-06-30 09:56:18
Just use ==
to judge. . .
Print it out to see if there are any encoding problems in the local and Linux environments. After pasting down the code, do you want us to type it again by hand? . .