Python开发小知识集(一)

发布时间:2019-09-11 07:46:27编辑:auto阅读(1848)

    1.在使用Beautifulsoup的,出现错误提示WARNING:root:Some characters could not be decoded, and were replaced with REPLACEMENT CHARACTER.说明在输出Unicode字符时,保存为默认的,ascii编码的字符串是ascii字符集中没有包含对应的,并且十有八九包含中文字符,所有报上述错误。

    解决错误需要做如下处理:

    soup=BeautifulSoup(WebContext,from_encoding="GBK")


关键字