# -*- coding:utf-8 -*-
制定编码为utf-8
出现 UnicodeDecodeError: 'utf8' codec can't decode byte 0xa1 in position 0: invalid start byte
可以用
str = unicode(str, errors='replace')
or
str = unicode(str, errors='ignore')
直接将文字替换掉 前提是文字是不需要的
获得系统的默认编码
import sys
print sys.getdefaultencoding()