在用py2写爬虫,将内容写入文件时出现 UnicodeEncodeError错误
解决方法:
str = str.replace(u'\u2019','\'').encode('utf8')
str = str.encode('utf8', 'ignore')