UnicodeEncodeError:'charmap'编解码器无法编码字符'\ u2010':字符映射至<undefined>
尝试打印从python 3.4中使用硒请求的网站获得的'Á'时,我不断收到UnicodeEncodeError。
我已经在.py文件的顶部定义了
# -*- coding: utf-8 -*-
def是这样的:
from selenium import webdriver
b = webdriver.Firefox()
b.get('http://fisica.uniandes.edu.co/personal/profesores-de-planta')
dataProf = b.find_elements_by_css_selector('td[width="508"]')
for dato in dataProf:
print(datos.text)
和例外:
Traceback (most recent call last):
File "C:/Users/Andres/Desktop/scrap/scrap.py", line 444, in <module>
dar_p_fisica()
File "C:/Users/Andres/Desktop/scrap/scrap.py", line 390, in dar_p_fisica
print(datos.text) #.encode().decode('ascii', 'ignore')
File "C:\Python34\lib\encodings\cp1252.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\u2010' in position 173: character maps to <undefined>
提前致谢
沧海一幻觉
红颜莎娜
守着一只汪
相关分类