Reputation: 197
I am getting started to the web scraping "world". This is my code:
import urllib
import urllib.request
from bs4 import BeautifulSoup
theurl = "https://twitter.com/realdonaldtrump";
thepage = urllib.request.urlopen(theurl)
soup = BeautifulSoup(thepage,"html.parser")
print (soup.title)
When I try to run the code I have the following error:
Traceback (most recent call last):
File "C:/Users/ACC/PycharmProjects/untitled/venv/imp.py", line 2, in <module>
import urllib.request
ImportError: No module named request
Process finished with exit code 1
I've already went to the project interpreter on settings and installed requests, and I've already did pip install requests on terminal.
Upvotes: 0
Views: 40
Reputation: 111
If you are using Python3 try using "requests" instead
pip3 install requests
Here is how I solve it ImportError: No module named requests
Upvotes: 1