'ascii' codec can't encode characters in position 3-6: ordinal not in range(128)
解决:
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
GBK 转 UTF8:
(text).decode('gbk').encode('utf-8')
UTF8 转 GBK:
(text).encode('utf-8').decode('gbk')
'ascii' codec can't encode characters in position 3-6: ordinal not in range(128)
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
GBK 转 UTF8:
(text).decode('gbk').encode('utf-8')
(text).encode('utf-8').decode('gbk')