pythonでメモ帳のデータを取得しようとしています
教本通りに書いたはずなのですが…
file = open( 'dics/random.txt', 'r', encoding = 'utf_8' ) data = file.read() file.close() lines = data.split("n") for line in lines: print(line)
エラー
Traceback (most recent call last):
File "C:/karakuri/Linux/Python/練習/ptna/gui型/read.py", line 7, in <module>
data = file.read()
File "C:\Users\lenovo Owner\AppData\Local\Programs\Python\Python36\lib\codecs.py", line 321, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x82 in position 0: invalid start byte
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/07/17 07:13
2017/07/17 07:15
2017/07/17 07:19