如何打开html文件? [英] How to open html file?
本文介绍了如何打开html文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个名为 test.html
的HTML文件,它有一个字בדיקה
。
I have html file called test.html
it has one word בדיקה
.
我打开test.html并使用这段代码打印内容:
I open the test.html and print it's content using this block of code:
file = open("test.html", "r")
print file.read()
>但它打印
,为什么会发生这种情况,我该如何解决?
but it prints ??????
, why this happened and how could I fix it?
。
编辑:我试过这个:
>>> import codecs
>>> f = codecs.open("test.html",'r')
>>> print f.read()
?????
推荐答案
import codecs
f=codecs.open("test.html", 'r')
print f.read()
尝试这样的。
这篇关于如何打开html文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文