摘要:
#绘制柱状图import matplotlib.pyplot as pltimport numpy as npx=[1,2,3,4,5,6]y=[3,4,5,6,7,8]c=np.mean(y)plt.bar(x,y,color="red",hatch="/",tick_label=["q","er 阅读全文
摘要:
import matplotlib.pyplot as pltimport matplotlib as mpl#下面的两行是解决中文乱码的问题,sans-serif就是无衬线字体,是一种通用字体族mpl.rcParams['font.sans-serif']=['SimHei']#指定默认字体是Si 阅读全文
摘要:
#!/usr/bin/perl@spam=("bat","cat","dath","datg");if (my $lines=grep {/dat/}@spam){#再标量上下文中,grep返回的是匹配到的个数 print "$lines\n";}@spam2=("bat","cat","dath" 阅读全文
摘要:
#!/usr/bin/perl#define functionsub Hello(){ print "Hello,world\n"}#calling functionHello();#define G() functionsub G(){ print "Hello ,G\n"}#calling G( 阅读全文
摘要:
import matplotlib.pyplot as pltimport numpy as npfig=plt.figure()ax1=fig.add_subplot(121)t=np.arange(0.0,5,0.01)s=np.cos(2*np.pi*t)line,=ax1.plot(t,s, 阅读全文
摘要:
import numpy as np import matplotlib.pyplot as plt def f(t): return np.exp(-t) * np.cos(2*np.pi*t) t1 = np.arange(0.0, 3.0, 0.01) ax1 = plt.subplot(21 阅读全文
摘要:
import matplotlib.pyplot as pltimport numpy as npx=np.linspace(0.05,10,1000)y=np.sin(x)plt.plot(x,y,ls="-.",lw=2.3,color="black",label="sin()")plt.ann 阅读全文
摘要:
import numpy as npimport matplotlib.pyplot as pltfrom scipy.optimize import curve_fit#用python拟合函数最主要模块就是cure_fit#准备数据x=[一组数据]y=[一组数据]#定义你自己想要拟合的函数def 阅读全文
摘要:
import matplotlib.pyplot as pltimport numpy as npimport matplotlib as mpl #解决中文乱码和正负号问题mpl.rcParams["font.sans-serif"]=["SimHei"]mpl.rcParams["axes.un 阅读全文
摘要:
#在图形中添加指示import matplotlib.pyplot as pltimport numpy as npx=np.linspace(0.05,10,1000)y=np.sin(x)plt.plot(x,y,label="plot figure",ls=":",c="red",lw=2)p 阅读全文
摘要:
pip install pyzmail不太好用 改成pip insall pyzmail36就可以了 阅读全文
摘要:
首先打开cmd,运行一下这个代码:start cmd /c \" python \"$file\" & pause\"然后打开sublime-tool-build system-build new system删除所有 copy-paste下面这些代码:{ // 指定python.exe的目录【针对 阅读全文
摘要:
1.打开notepa++按F5 在对话框中输入cmd /k C:\Strawberry\perl\bin\perl.exe "$(FULL_CURRENT_PATH)" & ECHO. & PAUSE & EXIT 保存之后 运行2,cmd /k C:\Program File(x86)\pytho 阅读全文
摘要:
#!/usr/bin/perlopen (file,"D:\\OUTCAR");$a=0;while ($lines=<file>){ if ($lines=~/TOTAL ELASTIC/){ $lines_number=$.; $a=1 } if ($a==1){ sub1() }}close( 阅读全文
摘要:
#!/usr/bin/perlopen (f,"D:\\excel");while ($lines=<f>){if ($lines=~/TOTAL ELASTIC/){$line_number=$.;$line_control=1;}next if ($line_control==0);#next后 阅读全文
摘要:
方法一: spam=['123','456','789']spam1=[]for i in spam: j=float(i) spam1.append(j)print(spam1) 方法二: 这段代码的功能是:读取excel中的数据,每十个数值取平均值 import xlrdimport numpy 阅读全文
摘要:
import re#split 只能实现单个字符串的分割string="guoshun is a good boy"print(string.split(' '))#但是如果中间又好几个空格 那么split耶只能分割一个空格string2="guoshun is good boy"#regex提供了 阅读全文