UnicodeDecodeError: 'gbk' codec can't decode byte 0x88 in position 2: illegal multibyte sequence
import jieba;
file_path = "F:\python\liying_wuli.txt";
new_path = "F:\python\1_liying_wuli.txt";
f = open(file_path);
line = f.readline();
while line:
print (line,
line=f.readline())
f.close()
解决办法
import jieba;
file_path = "F:\python\liying_wuli.txt";
new_path = "F:\python\1_liying_wuli.txt";
f = open(file_path,'r','utf-8');
line = f.readline();
while line:
print (line,
line=f.readline())
f.close()
http://blog.youkuaiyun.com/lqzdreamer/article/details/76549256
=========================================================================
OSError: [Errno 22] Invalid argument: 'F:\\python\x01_liying_wuli.txt'
解决办法:
new_path = r"F:\python\1_liying_wuli.txt"
或者 new_path = "F:\\python\\1_liying_wuli.txt"
https://www.cnblogs.com/cq90/p/6959567.html(