首页 > 解决方案 > "Â" 无法从 html 文件中读取

问题描述

我试图读取一个包含类似“Ordinary of  £0 each”的文件,但是当我打印“”时丢失了,即我得到了“0 Ordinary of £0 each”。下面是我的python代码

file1 = open(path+files[i]+".txt.html", 'r') 
Lines = file1.readlines()
for line in Lines: # read each line seperately
        print("line",line)

请帮忙

标签: pythonhtmlcharacter-encodinggoogle-colaboratory

解决方案


推荐阅读