#coding=utf-8
from tkinter.filedialog import *
f=askopenfile(title=“打开文件”,initialdir=“c”,filetypes=[(“文本亠件”,".txt")])
print(f.read())
运行结果
Traceback (most recent call last):
File “C:/Users/蒋军/PycharmProjects/gui/my12.py”, line 4, in
print(f.read())
UnicodeDecodeError: ‘gbk’ codec can’t decode byte 0xaf in position 2: illegal multibyte sequence