I'm trying to compare 2 strings, but == operator fails. they seem to have the same Value if you print them. Even the type is the same: class str, the output of print(repr( )) ist the same, .strip() doesn't helps either and comparing with in operator fails also.
the Strings are "Neues Textdokument.txt - Edito" and the windows window name of the editor
Thanks to the advice from @Random Davis it seems to be a Cyrillic letter in there, which look exactly like the latin letters. but if you check the strings a and b with: print([ord(c) for c in a]) print([ord(c) for c in b]) it shows, the unicode number of the letter in decimal. They seperate in e and M
So it turns out the strings just looked the same, but there were some unexpected unicode Cyrillic characters in the actual data which looked the same as ASCII characters. So, the solution was to run the following code to compare the comparison string with the actual string:
print([ord(c) for c in a])
print([ord(c) for c in b])
This showed that in the actual data, there were the Cyrillic characters "М" and "е", which caused the string comparison to return False
.