Python crawler character encoding error problem
曾经蜡笔没有小新
曾经蜡笔没有小新 2017-05-18 11:02:47
0
1
540

Crawling the content of Baidu Encyclopedia

response=urllib2.urlopen(url)

    if response.getcode()!=200:
        return None
    html=response.read()
    return html.decode("UTF-8")
    

Write another file. When writing, 'gbk' codec can't encode character 'xa0' in position 15 appears.
I use UTF8 encoding to write. How does it have anything to do with gbk? ? ?

曾经蜡笔没有小新
曾经蜡笔没有小新

reply all(1)
巴扎黑

Please post the complete code and exception information

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template