自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(11)
  • 收藏
  • 关注

原创 numpy

#取单行#print(t2[2])#取连续多行#print(t2[2:])#取不连续多行#print(t2[[2,8,10]]) 多加了一个括号#取连续的列#print(t2[:,2:]) #:号表示都要#取不连续多列#print(t2[:,[0,2])#取多行多列#b=(t2[2:5,1:4])#print(b)#修改值#t2[t2<10]=3 将大于10的数全部都改为3#三元换算#import numpy as np#np.where(t2>10.

2021-09-18 00:38:02 67

原创 maplotlip第二天

散点图from matplotlib import pyplot as pltimport matplotlib as mplmpl.rcParams['axes.unicode_minus'] = Falsempl.rcParams['font.sans-serif'] = ['SimHei']y_1=[11,17,12,15,18,19,21,26,25,23,26,15,25,15,14,14]y_2=[13,12,11,15,18,18,19,17,17,20,12,12,13,15.

2021-09-16 07:30:41 126

原创 matplotlib

绘图import matplotlib.pyplot as pltx=range(2,26,2) #以2为间隔取值y=[15,13,14.5,17,20,25,26,26,24,22,18,15]plt.figure(figsize=(20,8),dpi=200) #设置图片大小plt.plot(x,y) #绘图plt.xticks(range(2,25)) #设置X轴的刻度 以1为间隔取值#plt.savefig("./t1.png") #保存.

2021-09-15 20:23:25 83

原创 排序、、、

冒泡排序:def bubble_sort(alist): n=len(alist) for j in range(n-1): for i in range(0,n-1-j): # 从头走到尾 if alist[i]>alist[i+1]: alist[i],alist[i+1]=alist[i+1],alist[i]if __name__ =="__main__": li=[

2021-09-14 19:37:21 46

原创 单列表、栈、队列

#遍历整个列表class singlelistle(object): def __init__(self,node=None): self.head = node def is_empty(self): self.head == None def length(self): cur=self._head count=1 while cur !=None: count+=1 .

2021-09-13 00:18:08 166

原创 第十一天视频笔记

#文件的操作#打开文件 open# fobj=open('.test.txt','w',encoding='utf-8')# #开始操作 读/写操作# fobj.write('在苍茫的大海上')# fobj.write('狂风卷积乌云')# fobj.close()#二进制的形式去写数据# fobj=open('test_1.txt','wb')# fobj.write('在乌云和大海之间'.encode('utf-8'))# fobj.close()fobj=open('tes.

2021-09-03 22:31:44 81

原创 第九天视频笔记

class Student(): def __init__(self,A,B): self.A=A self.B=B pass def __str__(self): return'{}今天{}岁了'.format(self.A,self.B) passzyh=Student('张燕华',25)zyh.weight=80 #动态添加print(zyh)print(zyh.weight)zm=StudentStude.

2021-08-30 23:54:28 62

原创 第四天笔记

python函数带有参数的函数def printInfo(name,height,weight,hobby,pro): print('%s的体重是%f'%(name,height)) print('%s的身高是%f'%(name,weight)) print('%s的爱好是%s'%(name,hobby)) print('%s的专业是%s'%(name,pro)) passprintInfo('小王',180,173,'打游戏','咨询师')printI

2021-08-25 00:02:18 89

原创 第六天笔记

#取绝对值print(abs((-45)))#取近似值print(round(2.66,1))#保留一位小数#求幂print(pow(3,3))#取最大值print(max([23,325,45689,456132,1234565,11232]))#或者用下面的print(max(231,13254))#求和print(sum(range(10),3))#额外加3a,b,c=1,2,3print(eval('a+b+c'))内置函数转化#2进制print(bin(10)).

2021-08-24 23:59:15 51

原创 第五天笔记

不同的函数可以定义相同的局部变量,但是各自用各自的,相互之间不会影响当全局变量和局部变量出现重复定义的时候,程序会优先执行适用函数内部定义的变量,因为内部的级别高如果在函数的内部想要对全局变量进行修改的话,必须适用global关键字进行声明pro='计算机'pro就是全局变量def printInfo(): name='你好' #neme就是局部变量 print(name,pro) passdef testA(): name='peter' pri...

2021-08-23 21:46:27 85

原创 第三天草稿

索引Test='python'print('%s'%Test[0])print('%s'%Test[1])for item in Test: print(item,end=' ')去除空格a=' hello 'b=a.strip()print(b)首字母变大写name='peter'print('%s'%name.capitalize())a=' hello 'print(a.lstr.

2021-08-20 21:27:32 54

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除