UnicodeEncodeError: 'latin-1' codec can't encode characters in position 9-13: ordinal not in range(256)
类似这种的问题一般是中文编码错误,例如 :
print('sql语句正确'.encode("utf-8").decode("latin1"))
若不加.encode("utf-8").decode("latin1") 就会出现上边的错误。
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe4 in position 0: ordinal not in range(128)
'''解决方案:配置编程环境编码'''
import sys
reload(sys)
sys.setdefaultencoding('utf-8')