I've been trying to get the .text thingy in Python which converts html codes into readable text to work but still no luck.
Let's say I have the following code :
import urllib
url = ['http://google.com','http://bing.com']
for i in url:
html = urllib.urlopen(i).read()
print html.encode('utf-8').text
The code works once I remove the .text in the last line but I've seen people using that in tutorials without any problem at all. Any idea why couldn't I get it to work ? lol
Thank you very much !
import urllib
url = ['http://google.com','http://bing.com']
for i in url:
html = urllib.urlopen(i).read()
print html
No need for encode or text, just can print the html write after read(). I would suggest that you use python-requests.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With