Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
3 views
in Python by (16.4k points)

I have Html document called test.html it has single word בדיקה

I open the test.html and print its substance utilizing this block of code: 

file = open("test.html", "r")

print file.read()

however, it prints ??????, why this occurred and how is it possible that I would fix it? 

BTW. at the point when I open a text document, it works great.

I also tried:

>>> import codecs

>>> f = codecs.open("test.html",'r')

>>> print f.read()

?????

1 Answer

0 votes
by (26.4k points)

Try the following code:

import codecs

f=codecs.open("test.html", 'r')

print f.read()

Are you looking for a good python tutorial? Join the python course fast and gain more knowledge in python.

Watch this video tutorial on how to become a professional in python

Related questions

0 votes
1 answer
0 votes
1 answer
asked Feb 24, 2021 in Python by laddulakshana (16.4k points)
0 votes
2 answers

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...