文章目录 练习题1、打开中文字符的文档时,会出现乱码,Python自带的打开文件是否可以指定文字编码?还是只能用相关函数?2、编写程序查找最长的单词 练习题 1、打开中文字符的文档时,会出现乱码,Python自带的打开文件是否可以指定文字编码?还是只能用相关函数? 可以指定编码,encoding 'utf-8' 2、编写程序查找最长的单词 输入文档: res/test.txt 题目说明: """ Input file test.txt Output file ['general-purpose,', 'object-oriented,'] """ def longest_word(filename): # your code here pass