摘要:#序列化:把变量从内存变成可存储或者传输的过程#反序列化:把变量内容从序列化对象重新读取到内存里
阅读全文
摘要:class Screen(object): @property #读取with的值getter方法 def width(self): return self._width @width.setter #设置with的值setter方法 def width(self,value): self._width = value ...
阅读全文
摘要:并发:在同一个时间段交替执行多个任务并行:在同一个时间点同时执行多个任务串行:同时执行的多个任务按顺序执行(换句话说就是一个任务执行完后才能执行下一个任务) #mysql limit用法: select * from table limit m,n;m表示第m+1条数据起(因为索引是从零开始的)n表
阅读全文
摘要:#定义一个类Student class Student(object): __slots__ = ('name','age') #用元组(tuple)的形式绑定属性名称 s = Student() s.name = 'xh' print s.name #xh #s.score = 88 #因为 __slots__中没有score属性,所以报错 #print s.score #A...
阅读全文
摘要:#定义一个类Student class Student(object): pass #给类增加一个属性name Student.name = 'xm' print Student.name # xm #给类增加一个方法set_age def set_age(self,age): self.age = age Student.set_age = set_age s = Stu...
阅读全文