UnicodeEncodeError with BeautifulSoup 3.1.0.1 and Python 2.5.2

随声附和 提交于 2019-12-04 12:37:36

Here is another idea. Your terminal is not capable of displaying an unicode string from Python. The interpreter tries to convert it to ASCII first. You should encode it explicitly before printing. I don't know the exact semantics of soup.findAll(). But it is probably something like:

for t in  soup.findAll("table"):
    print t.encode('latin1')

If t really is a string. Maybe its just another object from which you have to build the data that you want to display.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!