0
私はPythonプログラミングの初心者です。だから、この質問がどれほど基本的なのか分かりません。私はPython 3.5でグジャラートのテキストファイルを処理したいです。このコードブロックを実行しようとすると、エラーが発生しました。このエラーを修正するにはどうすればよいですか?python 3.5で英語以外のテキストファイル(グジャラート語)を開いたり、読み書きしたりするにはどうすればよいですか?
import tkinter.filedialog
import fileinput
import tkinter
filename1 = tkinter.filedialog.askopenfile()
my_file = open(filename1, "r", encoding= "utf-16")
content = my_file.read()
print(content)
エラー:
Traceback (most recent call last):
File "D:\PhD\python workspace\guj.py", line 8, in <module>
my_file = open(filename1, "r", encoding= "utf-16")
TypeError: invalid file: <_io.TextIOWrapper name='D:/PhD/python workspace/text files/Gujarati.txt' mode='r' encoding='cp1252'>
Mr. Xamuel。その働き。 – Uttam