python
cuterabbitbaby
这个作者很懒,什么都没留下…
展开
-
Anaconda概述(spyder与ipython)
问号可用来显示变量信息和函数信息原创 2018-01-17 14:30:58 · 6306 阅读 · 1 评论 -
python的字典
dictfromkeyskey-value获得键和值getcopy创建一个新的副本popitem:随机弹出一个键值setdefault:随机插入一个键值update:...原创 2019-04-27 12:43:11 · 80 阅读 · 0 评论 -
python的集合
去除列表中的重复元素添加和移除集合不变原创 2019-04-27 12:58:15 · 78 阅读 · 0 评论 -
python的文件
一行一行打印写入# -*- coding: utf-8 -*-"""Created on Sat Apr 27 13:42:20 2019@author: Administrator"""def saveFile(boy,girl,count): fileNameBoy='boy'+str(count)+'.txt' file...原创 2019-04-27 18:22:05 · 114 阅读 · 0 评论 -
python的OS模块
OS模块:操作系统模块原创 2019-04-27 19:11:24 · 85 阅读 · 0 评论 -
Python的pickle模块读写文件
把list写入文件并读取原创 2019-04-27 19:22:53 · 2596 阅读 · 0 评论 -
python初识
代码print("hello python")print(5+3)print("hello"+" python")print("hello python\n"*8)代码结果注:spyder快捷键tab自动补全原创 2019-04-18 18:53:35 · 120 阅读 · 0 评论 -
python条件语句
1.缩进表示大括号2.冒号后编译器会自动缩进3.条件语句格式if statement: statementelse: statement4.F5运行程序5.BIF :built in function内置函数代码b=input("please input a number: ")a=int(b)#这里的int也相当于函数,将里面的参数变为整形...原创 2019-04-18 20:01:39 · 87 阅读 · 0 评论 -
python的异常
raise:自发引入异常# -*- coding: utf-8 -*-"""Created on Mon Apr 29 09:26:30 2019@author: Administrator"""try: # int("abc") f=open("打开一个文件.txt","w") f.write("你好啊") # sum=1...原创 2019-04-29 10:11:06 · 129 阅读 · 0 评论 -
python的else和with
with就会自动关闭文件原创 2019-04-29 10:19:16 · 177 阅读 · 0 评论 -
python的模块
原创 2019-05-14 17:13:24 · 166 阅读 · 0 评论 -
python的类和对象
事实上,_变量名被编译为_类名_变量名把多个类合成一个类原创 2019-05-10 00:34:11 · 166 阅读 · 0 评论 -
python的字符串
str.capitalize():把字符串的第一个字符大写str.casefold():把字符串全改小写str.center(width):把字符串居中,并用空格填充至width宽度str.count('xi'):查找字符xi出现的次数str.endwith('xi'):检查字符是否以xi结尾str.expandtabs():把字符串中的tab转为8个空格str.find(...原创 2019-04-22 23:11:05 · 132 阅读 · 0 评论 -
python的元组
元组与列表的区别是不能随便改变元素元组创建时用的是小括号,元组的逗号是其标志元组的更新和删除原创 2019-04-22 22:13:24 · 76 阅读 · 0 评论 -
python的列表
列表的函数list.count (a):列表list中元素a出现的次数list.index(a):列表list中元素a的第一次出现的位置list.index(a,3,7):列表list中元素a的在范围3到7出现的位置list.reverse():把列表翻转list.sort():把列表从小到大排序list.sort(rev...原创 2019-04-22 21:58:07 · 235 阅读 · 0 评论 -
数据与python表示
原创 2018-01-17 14:46:42 · 242 阅读 · 0 评论 -
numpy
注:linspace默认生成的是浮点数,endpoint表示最后一个元素10是否是生成元素的一个注:一个数组的维数是从0开始的原创 2018-01-17 19:19:42 · 208 阅读 · 0 评论 -
matplotlib
注:normal=1为归一化,normal=0则输出个数原创 2018-01-17 22:09:02 · 152 阅读 · 0 评论 -
pandas
原创 2018-01-18 11:23:55 · 211 阅读 · 0 评论 -
python变量和字符串
原创 2019-04-21 18:37:25 · 77 阅读 · 0 评论 -
猜数字(python,if,while,随机数)
# -*- coding: utf-8 -*-"""Created on Sun Apr 21 18:46:50 2019功能:产生随机数,用户猜测数字是否正确@author: Administrator"""import random#导入随机数模块secret=random.randint(1,10)#产生一个1到10的随机数guessStr=input("p...原创 2019-04-21 19:22:59 · 1133 阅读 · 1 评论 -
python的数据类型转换与判定
注:浮点数转为整型,直接去除小数点后的数(5.9-5)type(数):返回类型isinstance(数,类型)返回布尔值原创 2019-04-21 20:02:10 · 375 阅读 · 0 评论 -
python运算符
注://:表示地板出发10.0//8.0=1.0//3**2表示3的二次方3<4<5解释为(3<4)and(4<5)原创 2019-04-21 20:21:46 · 80 阅读 · 0 评论 -
python分支和循环
原创 2019-04-21 21:33:39 · 194 阅读 · 0 评论 -
python的函数
函数的注释文档函数中有默认参数收集参数:把所有参数打包成元组,然后组成paramspython的返回值global函数内嵌函数闭包匿名函数过滤器filter:把非true的内容删除掉map递归:求阶乘...原创 2019-04-26 16:49:54 · 81 阅读 · 0 评论 -
python的魔法方法
构造函数析构函数所有指向该对象的引用都被删除时,析构函数调用魔法方法是指Python内部已经包含的,被双下划线所包围的方法,这些方法在进行特定的操作时会自动被调用打印类# -*- coding: utf-8 -*-"""Created on Sun May 12 15:03:21 2019@author: Adm...原创 2019-05-13 10:03:01 · 211 阅读 · 0 评论