UnicodeEncodeError: 'ascii' codec can't encode character u'\xa0' in position 20: ordinal not in range(128)

后端 未结 29 2937
余生分开走
余生分开走 2020-11-21 04:43

I\'m having problems dealing with unicode characters from text fetched from different web pages (on different sites). I am using BeautifulSoup.

The problem is that

29条回答
  •  醉梦人生
    2020-11-21 05:09

    well i tried everything but it did not help, after googling around i figured the following and it helped. python 2.7 is in use.

    # encoding=utf8
    import sys
    reload(sys)
    sys.setdefaultencoding('utf8')
    

提交回复
热议问题