Skip to content

How to read a website in Python?

import urllib.request

try:
   with urllib.request.urlopen('http://www.python.org/') as f:
      print(f.read().decode('utf-8'))
except urllib.error.URLError as e:
   print(e.reason)
print('i thik this is how u do it')
See also  Python code snippet - How to use one hot encoding in multiple columns at once?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.