UnicodeDecodeError at /app/file/
'utf-8' codec can't decode byte 0xd0 in position 0: invalid continuation byte
とエラーが出ました。
# -*- coding: utf-8 -*- import os os.chdir('./app/') file = open('text.doc','r') string = file.read()
とコードを書きました。text.docの中身は全て日本語です。ユニコードのエラーだと思ったのですが、
file = open('text.doc',encoding='utf-8')
とコードを書いてもうまくいきませんでした。何が問題なのでしょうか?