1、python字符串转换UnicodeDecodeError: 'utf8' codec can't decode byte 0xc4 in position 10: invalid continuat
原因是:写入数据库中字段label包含中文
解决办法:
import sys
reload(sys)
sys.setdefaultencoding('gb18030')
unicode(label).encode("utf-8")
1、python字符串转换UnicodeDecodeError: 'utf8' codec can't decode byte 0xc4 in position 10: invalid continuat
原因是:写入数据库中字段label包含中文
解决办法:
import sys
reload(sys)
sys.setdefaultencoding('gb18030')
unicode(label).encode("utf-8")