I am getting error while scraping links with beautiful soup. Here is the program.
The issue has been resolved with
from urllib.request import urlopen
from bs4 import BeautifulSoup
websitecode = urlopen("https://www.google.com").read()
soup=BeautifulSoup(websitecode, "html.parser")
links=soup.findAll("a")
print(links)Here is the error.Error:Traceback (most recent call last):
File "test.py", line 7, in <module>
print(links)
File "C:\Python34\lib\encodings\cp437.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_map)[0]
UnicodeEncodeError: 'charmap' codec can't encode characters in position 1308-131
3: character maps to <undefined>I am using python 3.4.3. I appreciate the forum's cooperation.The issue has been resolved with
requests and encode("utf-8").
