Question: I am trying to import BeautifulSoup in my python project but I am getting the error: Traceback (most recent call last): File C:UsersKristen AlbrechtOneDriveJoint DocumentsEducationUCLA
I am trying to import BeautifulSoup in my python project but I am getting the error:
Traceback (most recent call last): File "C:\Users\Kristen Albrecht\OneDrive\Joint Documents\Education\UCLA Applications Programing\Python\Week 7\KristenAlbrechtProject7\google.py", line 2, in
I am using pydev in eclipse. and my file looks like this:
import urllib.request import BeautifulSoup
def main(): term = input('Enter a search term: ') url = 'http://www.google.com/search' value = {'q' : term} user_agent = 'Mozilla/5.0' headers = {'User-Agent' : user_agent} data = urllib.parse.urlencode(value) print(data) url = url + '?' + data print(url) req = urllib.request.Request(url, None, headers) response = urllib.request.urlopen(req) html = response.read() print(html) main()
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
