
python
DayOneMore
这个作者很懒,什么都没留下…
展开
-
Mac python2 python3共存
https://www.jianshu.com/p/d19a37e1bbd9python3画图和python2不同,更好看一些原创 2021-03-24 14:16:47 · 366 阅读 · 0 评论 -
python 常用画图总结
官方文档:https://matplotlib.org/stable/gallery/index.html# coding=UTF-8import matplotlibimport matplotlib.pyplot as pltimport numpy as np# import sys# reload(sys)# sys.setdefaultencoding('utf-8')labels = ['5ms','10ms','50ms','100ms','500ms','1000ms',原创 2021-03-24 14:15:21 · 239 阅读 · 0 评论 -
ValueError matplotlib display text must have all code points 128 or use Unicode strings
错误问题:ValueError: matplotlib display text must have all code points < 128 or use Unicode strings错误原因:在使用matplotlib进行图表展示时,如果需要在图表上添加中文,可能会报字符类型的值错误。解决办法:重新调用系统,修改默认的字符类型。import sysreload(sys)sys.setdefaultencoding('utf-8')说明:一般在我们写程序的过程中,经常会遇到这种字符原创 2021-03-23 20:23:14 · 462 阅读 · 0 评论 -
python中有中文报错
在python程序中,只要有中文就会报错,不管是否在注释里。SyntaxError: Non-ASCII character '\xe5' in file paint.py on line 14, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details原因python的默认编码文件是用的ASCII码,python文件中使用了中文等非英语字符。解决办法在Python源文件的最开始一行,加入一句:#原创 2021-03-23 20:20:53 · 3177 阅读 · 0 评论