文章分类 - Python
Python的学习记录
摘要:1.在子类中调用父类的方法 在子类派生出的新方法中,往往需要重用父类的方法,我们有两种实现方式: 方式一:父类名.父类方法() 方式二:super().父类方法() 两种方式的区别:方式一是跟继承没有关系的,方式二是依赖于继承的,并且即使没有直接继承关系,super()仍然会按照__mro__继续往
阅读全文
摘要:面向对象的基本知识就不多做介绍了,主要记录一下面向对象的注意事项 1.基类的构造方法 2.面向对象中self的含义,以及继承中易错的点 注意:此时调用c.xxx()函数时,函数的查找顺序如下:C -> A -> B,而B中xxx()函数,内部调用self.f1()函数,此时的self为C的实例对象,
阅读全文
摘要:在开始介绍时间模块之前先说明几点: 一. Python中常用以下几种形式表示时间 1.时间戳 2.格式化的时间字符串 3.元组(struct_time)(共九个元素),由于Python的time模块实际是调用C库,所以各个平台可能有所不同。 二. 几个定义 UTC亦格林威治天文时间,世界标准时间。在
阅读全文
摘要:一.迭代器 迭代器是访问集合元素的一种方式。迭代器从访问到集合的第一个元素开始访问,直到所有元素被访问结束。而且迭代器只能往前访问,不能后退。另外迭代器的另一个优点,不会事先准备好访问的集合的所有元素。迭代器只有在迭代到某个元素后才会访问元素,而在这之前或之后,元素可以不存在或者销毁,这个特点是他特
阅读全文
摘要:简介 configparser在Python2.x中定义为ConfigParser,该模块的作用就是使用配置文件,配置文件的格式和windows中ini文件格式相同。 该模块的作用就是RawConfigParser()、ConfigParser()、SafeConfigParser()这三个方法,创
阅读全文
摘要:sys模块常用操作如下: 1.命令行参数 sys.argv 第一个元素是程序本身路径 2.退出程序 sys.exit(n) ,正常退出程序sys.exit(0) 3.获取当前python的版本 sys.version 4.获取模块的搜索路径 sys.path ,第一个''代表当前模块的所在的目录 5
阅读全文
摘要:官方文档 Construct an iterator from those elements of iterable for which function returns true. iterable may be either a sequence, a container which suppo
阅读全文
摘要:Take two (non complex) numbers as arguments and return a pair of numbers consisting of their quotient and remainder when using integer division. With
阅读全文
摘要:官方文档 Without arguments, return the list of names in the current local scope. With an argument, attempt to return a list of valid attributes for that o
阅读全文
摘要:This is a relative of setattr(). The arguments are an object and a string. The string must be the name of one of the object’s attributes. The function
阅读全文
摘要:官方文档 class complex([real[, imag]]) Return a complex number with the value real + imag*1j or convert a string or number to a complex number. If the fir
阅读全文
摘要:官方文档 Compile the source into a code or AST object. Code objects can be executed by exec() or eval(). source can either be a normal string, a byte stri
阅读全文
摘要:官方文档: Transform a method into a class method. A class method receives the class as implicit first argument, just like an instance method receives the
阅读全文


浙公网安备 33010602011771号