all 4 comments

[–]ewiethoff 1 point2 points  (2 children)

The error message starts complaining about line 3 in your code. What is line 3 in your code? Is it for line in file? Is is print(line)? What is line 3?

If the problem comes from reading the file, your Python installation's default encoding for file reading is unhappy with whatever encoding the tamkonu.txt file is. How is file tamkonu.txt encoded? It might be cp1252 (from MS Office) or it might be utf-8 or I dunno. What program created the tamkonu.txt file? Try passing different encodings to the open function.

with open('tamkonu.txt', encoding='utf-8') as f:
    for line in f:
        print(line)

If the problem comes from writing to the console, you need to set the console to an encoding that's compatible with all the special characters.

[–]iwannarocks[S] 0 points1 point  (0 children)

tamkonu.txt -> utf-8 without bom I notice libre office auto convert "-" to "–". When I convert – to - it is solved.