I work with dictionary and I want to detect keys which contains non-english characters like 'č' for example.
This is my code:
for i in dictionaryMemory.keys():
czechChars=['á','é','í','ó','ů','ě','ř','ť','č','š','ž']
if any(s in i for s in czechChars):
dictionaryMemory.pop(i)
print(i)
But when I try to run this code, eclipse prints that SyntaxError: Non-ASCII character '\xc3' in file...
Ok, so I try to put # -*- coding: utf-8 -*-¨. It seems to work, but it can't find any of these characters. What to do?
EDIT: In the project properties I found this: Text file encoding: inherited from container(Cp1250)
I have a problems with encoding very usually but can't still figure out how to do it in a proper way...
# -*- coding: utf-8 -*-eclipse has a tendency to convert all non-ascii characters already in the file to ?. So make sure that after you add that, and save - they're not all deleted.utf-8tocp1250.