摘要: 析构函数:__del__() 释放对象是自动调用class Person(object): def run(self): print("run") def eat(self, food): print("eat" + food) def __init__(self,name,age,height,w 阅读全文
posted @ 2019-03-04 15:57 飞飞阿 阅读(3651) 评论(0) 推荐(0) 编辑
摘要: #创建类class Person(object): # 定义属性(定义变量) name = "" age = 0 height = 0 weight = 0 def run(self): print("run") def eat(self, food): print("eat" + food) de 阅读全文
posted @ 2019-03-04 15:49 飞飞阿 阅读(1566) 评论(0) 推荐(0) 编辑
摘要: 类:是一直数据类型,本身不占内存空间,跟number,string,boolean等类似 用类创建实例化对象(变量),对象占内存空间格式:class 类名(父类列表): 属性 行为 self 代表类的实例,不是类 哪个对象调用方法,那么该方法中的self就代表对象,self不是关 键字,换成其他标识 阅读全文
posted @ 2019-03-04 15:40 飞飞阿 阅读(1232) 评论(0) 推荐(0) 编辑
摘要: #邮箱分类import osimport collectionsdef work(path): resPath=r"D:\f\Python\pycharm\234\分类" #打开文件 with open(path,"r")as f: while True: lineInfo=f.readline() 阅读全文
posted @ 2019-03-03 15:59 飞飞阿 阅读(526) 评论(0) 推荐(0) 编辑
摘要: 1#from……import导入模块#作用:从模块中导入一个指定的部分当命名空间#格式:from module import name[,name2][,name(n)]from tom import say1,say22import tom #引入自定义模块 #__int__ #__name__用 阅读全文
posted @ 2019-03-03 12:33 飞飞阿 阅读(308) 评论(0) 推荐(0) 编辑
摘要: '''UTC:标准时间。中国是UTC-8(东8区)DST:夏令时,人为规定时间制度,正常是夏季调快1小时''''''时间的表示形式:1、时间戳(以整形或浮点型表示时间的一个以秒为单位的时间间隔 这个时间间隔的基础值是从1970年1月1日0点开始算的)2、元组 一个Python的数据结构表示,这个元组 阅读全文
posted @ 2019-03-02 13:00 飞飞阿 阅读(1609) 评论(0) 推荐(0) 编辑
摘要: 用队列模拟递归(广度遍历)import osimport collectionsdef getAllDirQU(path): queue=collections.deque() #进队 queue.append(path) while len(queue)!=0: #出队数据 dirPath=que 阅读全文
posted @ 2019-02-27 23:06 飞飞阿 阅读(177) 评论(0) 推荐(0) 编辑
摘要: #用栈的方式模拟递归遍历目录import osdef getAllDirDE(path): stack=[]#定义空栈 stack.sppend(path)#给栈赋值当前文件路径 #处理栈,当栈为空时结束循环 while len(stack)==0: #从栈里取出数据(绝对路径) dirPath=s 阅读全文
posted @ 2019-02-27 14:52 飞飞阿 阅读(169) 评论(0) 推荐(0) 编辑
摘要: import os#os模块def getAllDir(path,sp=""): #得到当前目录下所有的文件 filesList=os.listdir(path) #出来每一个文件 sp+=" "#打印一个空格 for fileName in filesList: #判断是否是路径(绝对路径) fi 阅读全文
posted @ 2019-02-26 12:26 飞飞阿 阅读(258) 评论(0) 推荐(0) 编辑
摘要: 栈#模拟栈结构#栈有先后顺序的。后进的先取出,先进的最后取出stack=[]#压栈(向栈里存数据)stack.append("a")print(stack)stack.append("b")print(stack)#出栈(在栈里取数据)res1=stack.pop()print("res1=",re 阅读全文
posted @ 2019-02-26 11:56 飞飞阿 阅读(494) 评论(0) 推荐(0) 编辑