lixiang0 / WEB_KG

爬取百度百科中文页面,抽取三元组信息,构建中文知识图谱
http://kg.rubenxiao.com
928 stars 189 forks source link

python3.6 get UnicodeEncodeError: 'ascii' codec can't encode characters in position 11-14: ordinal not in range(128) #11

Open Yazhou-Liu opened 5 years ago

Yazhou-Liu commented 5 years ago

Traceback (most recent call last): File "html_parser.py", line 55, in newurls, = parser.parse(content) File "html_parser.py", line 44, in parse is_saved = self._save_new_data( soup,html_cont) File "html_parser.py", line 34, in _save_new_data with open(os.path.join(path ,title+'.html'), 'w') as f: UnicodeEncodeError: 'ascii' codec can't encode characters in position 11-14: ordinal not in range(128)

lixiang0 commented 5 years ago

这个是Windows编码问题。建议用ubuntu运行。