url1 = "https://en.wikisource.org/"+selectedbook['href']
r1 = requests.get(url1)
Soup1 = BeautifulSoup(r1.text, "html5lib")
List1 = Soup1.find("div", class_="prp-pages-output").find_all('p')
words=str(List1)
ebook1= open('ebook1.txt', 'w')
ebook1.write(words)
ebook1.close()
This is the last part of my code. When I run this, I get this error:
Traceback (most recent call last):
File "homework.py", line 35, in <module>
ebook1.write(words)
File "C:\Users\Özdal\AppData\Local\Programs\Python\Python38-32\lib\encodings\cp1254.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\u200b' in position 3121: character maps to <undefined>
I just want to download a file that includes paragraghs of this url: https://en.wikisource.org/wiki/Animal_Life_and_the_World_of_Nature/1903/06/Notes_and_Comments
Why do I get this error?
url1 = "https://en.wikisource.org/"+selectedbook['href']
r1 = requests.get(url1)
Soup1 = BeautifulSoup(r1.text, "html5lib")
List1 = Soup1.find("div", class_="prp-pages-output").find_all('p')
words=str(List1)
ebook1= open('ebook1.txt', 'w')
ebook1.write(words)
ebook1.close()
This is the last part of my code. When I run this, I get this error:
Traceback (most recent call last):
File "homework.py", line 35, in <module>
ebook1.write(words)
File "C:\Users\Özdal\AppData\Local\Programs\Python\Python38-32\lib\encodings\cp1254.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\u200b' in position 3121: character maps to <undefined>
I just want to download a file that includes paragraghs of this url: https://en.wikisource.org/wiki/Animal_Life_and_the_World_of_Nature/1903/06/Notes_and_Comments
Why do I get this error?
url1 = "https://en.wikisource.org/"+selectedbook['href']
r1 = requests.get(url1)
Soup1 = BeautifulSoup(r1.text, "html5lib")
List1 = Soup1.find("div", class_="prp-pages-output").find_all('p')
words=str(List1)
ebook1= open('ebook1.txt', 'w')
ebook1.write(words)
ebook1.close()
This is the last part of my code. When I run this, I get this error:
Traceback (most recent call last):
File "homework.py", line 35, in <module>
ebook1.write(words)
File "C:\Users\Özdal\AppData\Local\Programs\Python\Python38-32\lib\encodings\cp1254.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\u200b' in position 3121: character maps to <undefined>
I just want to download a file that includes paragraghs of this url: https://en.wikisource.org/wiki/Animal_Life_and_the_World_of_Nature/1903/06/Notes_and_Comments
Why do I get this error?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.