python UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 2: ordinal not in range(128)错误解决办法

import sys

 

reload( sys )
sys.setdefaultencoding('utf-8')

 

 

在需要print的地方,前面加上u

print u'%-18s %-12s %s' % (truncate(entry.title.text.encode('UTF-8')),
entry.GetDocumentType(),
entry.resourceId.text)

来自:http://www.cnblogs.com/keepfocus/archive/2011/10/11/2207482.html

你可能感兴趣的:(position)