摘要: import osspam=os.listdir('D:\\shu')j=0spam2=['h','i']for i in spam: os.rename('D:\\shu\\{}'.format(i),'D:\\shu\\{}'.format(spam2[j])) #前面一个参数是要修改的文件夹 阅读全文
posted @ 2019-08-23 09:45 朵朵奇fa 阅读(538) 评论(0) 推荐(0) 编辑
摘要: #利用python完成自动化的任务#遍历文件夹里面的所有的内容--然后打开 利用正则表达式修改文本的内容(re.sub) 然后写入到新的文本内容中import docximport reimport osfilename=os.listdir('D:\\新建文件夹')#获取文件夹里面的所有的文本os 阅读全文
posted @ 2019-08-23 09:43 朵朵奇fa 阅读(809) 评论(0) 推荐(0) 编辑
摘要: import matplotlib.pyplot as plt import numpy as np x=["q","w","e","r","t","y"]#不变的依然是x表示标签值 y=[4,6,7,6,3,9] plt.barh(x,y,align="center",color="green", 阅读全文
posted @ 2019-08-23 09:41 朵朵奇fa 阅读(3638) 评论(0) 推荐(0) 编辑
摘要: #画图的基本命令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,c='red',label='sin(x)')plt.le 阅读全文
posted @ 2019-08-23 09:38 朵朵奇fa 阅读(29310) 评论(0) 推荐(0) 编辑
摘要: import matplotlib as mplimport matplotlib.pyplot as pltx=["a","b","c","d","e","f"]y=[2,3,6,7,9,5,]y1=[5,8,9,3,4,6,]plt.xlim(0,20)plt.barh(x,y,align="c 阅读全文
posted @ 2019-08-23 09:36 朵朵奇fa 阅读(3279) 评论(0) 推荐(0) 编辑
摘要: #绘制柱状图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 阅读全文
posted @ 2019-08-22 21:55 朵朵奇fa 阅读(4901) 评论(0) 推荐(1) 编辑
摘要: import matplotlib.pyplot as pltimport matplotlib as mpl#下面的两行是解决中文乱码的问题,sans-serif就是无衬线字体,是一种通用字体族mpl.rcParams['font.sans-serif']=['SimHei']#指定默认字体是Si 阅读全文
posted @ 2019-08-22 21:54 朵朵奇fa 阅读(270) 评论(0) 推荐(0) 编辑
摘要: #!/usr/bin/perl@spam=("bat","cat","dath","datg");if (my $lines=grep {/dat/}@spam){#再标量上下文中,grep返回的是匹配到的个数 print "$lines\n";}@spam2=("bat","cat","dath" 阅读全文
posted @ 2019-08-22 21:53 朵朵奇fa 阅读(801) 评论(0) 推荐(0) 编辑
摘要: #!/usr/bin/perl#define functionsub Hello(){ print "Hello,world\n"}#calling functionHello();#define G() functionsub G(){ print "Hello ,G\n"}#calling G( 阅读全文
posted @ 2019-08-22 21:52 朵朵奇fa 阅读(387) 评论(0) 推荐(0) 编辑
摘要: 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, 阅读全文
posted @ 2019-08-22 21:47 朵朵奇fa 阅读(2719) 评论(0) 推荐(0) 编辑