
python
RiddleMa
这个作者很懒,什么都没留下…
展开
-
spyder下使用matplotlib绘图中文显示不出来-解决过程记录
初学python,安装anaconda集成环境,使用matplotlib库绘图,标题和标签中文显示不出来,英文可以。一、前后结果对比import sysfrom matplotlib import pyplot as pltyears = [1960,1960,1970,1980,1990,2000,2010]gdp = [300.2,543.3,1075.9,2862.5,5979转载 2017-09-13 21:56:33 · 9464 阅读 · 0 评论 -
python 知识记录
>>>temp = ones((3, 1)) #创建数组>>>temparray([[ 1.], [ 1.], [ 1.]])>>>weights = mat(w) #转换为numpy矩阵>>>weightsmatrix([[ 1.], [...转载 2018-05-18 10:55:10 · 269 阅读 · 0 评论 -
seek函数导致UnicodeDecodeError的错误
python文件处理的时候遇到这样的错UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe5 in position 0: invalid start byte我的代码file = open('sss.txt','r',encoding='utf-8')file.seek(1)str = file.readline()seek函数的作用...原创 2018-05-25 15:51:10 · 638 阅读 · 1 评论 -
python2 转 python3 记录
print的替换使用正则表达式 :print\s*(\S.*)$ 替换为 print($1)转载 2018-05-15 14:50:27 · 247 阅读 · 0 评论 -
正则表达式匹配固定个字符
正则表达式匹配固定个字符查找了很多都没有找到答案,最后在知乎上找到了。问题:怎么使用匹配正则表达式匹配两个相同的字母,而不要匹配三个相同的字母?比如使用正则表达式匹配“aa”,出现baab时可以匹配其中的aa;出现baaab时,则不要匹配其中的任何一个aa,也就是回报查询无果。正则表达式能做到么?答案:怎么使用匹配正则表达式匹配两个相同的字母,而不要匹配三个相同的字母?比如使用正则...转载 2018-11-20 22:56:00 · 10624 阅读 · 0 评论