求解 askopenfile 编码错误
2020-06-29 04:49
1201 查看
#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
相关文章推荐
- vs2013+opencv2.4.13出现LINK : fatal error LNK1104: cannot open file 'opencv_calib3d2413d.lib'错误,求解
- 记一次恢复mysql后启动报libjemalloc.so.1: cannot open shared object file错误问题
- Linux下使用vi新建文件保存文件时遇到错误:E212: Can't open file for writing
- 关于OpenFileDialog与SaveFileDialog的错误
- 打开一个类文件时出现:Cannot open precompiled header file 的错误的解决方法
- VC编译程序时Cannot open precompiled header file: 'Debug/.pch': No such file or directory错误处理
- modelsim10.4仿真错误Error: (vlog-7) Failed to open design unit file "XXXXX" in read mode解决办法
- vs2010出现link错误: fatal error LNK1104,cannot open file ***.???.lib解决办法
- 【android模拟器 avd路径错误】Could not open AVD config file: D:\鎴戠殑鏂囨。\.android\.android\avd\jjjj.avd/config.
- 运行错误:error while loading shared libraries: xxx.so.0:cannot open shared object file: No such file or
- svn版本控制的Xcode工程打不开 ,报 the file cannot open错误 的解决办法
- MYSQL启动错误之[ERROR] Failed to open log (file './mysql-bin.000039', errno 2)
- 关于写入文件缓存时报"java.io.FileNotFoundException open failed (is a director)"错误的解决方法
- 错误:预编译头文件 fatal error C1083: Cannot open precompiled header file: 'Debug
- file_put_contents 错误:failed to open stream: Invalid argument 一种原因
- Apache启动错误:No such file or directory httpd: could not open error log file......
- Codeblocks-使用错误整理(1)cannot open output file
- 解决错误 libmysqlclient.so.18: cannot open shared object file: No such file or directory
- 在VC6.0用file->open后,出现“MSDEV.EXE-应用程序错误
- 安装pymysql、mysql-python 安装错误 fatal error C1083: Cannot open include file: 'config-win.h':