python error整理

ValueError: invalid literal for int () with base 10.

int()传的值有问题,之前我传了string类型的

Python2.7 报错:UnicodeEncodeError: 'ascii' codec can't encode characters in position 3-4: ordinal not in range(128) 

涉及到中文编码,python处理字符流默认是ascii。解决:

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

参考

猜你喜欢

转载自www.cnblogs.com/shona/p/12240198.html
今日推荐