Urllib module error! AttributeError: the 'module' object does not have the 'request' attribute

I currently played with the 'urllib' module in python and tried to extract the website source code:

import urllib temp = urllib.request.urlopen('https://www.quora.com/#') 

However, I get the following error:

Traceback (last last call): File ", line 1, in temp = urllib.request.urlopen (' https://www.quora.com/# ') AttributeError: the 'module' object does not have the 'request' attribute

I am using Python 2.7.5.

+6
source share
1 answer

It seems that you are reading the Python 3.x documentation .

This is urllib.urlopen in Python 2.x.

+12
source

Source: https://habr.com/ru/post/957196/


All Articles