摘要:
# __author__ = "Alex Li"#面向对象介绍## 世界万物,皆可分类# 世界万物,皆为对象## 只要是对象, 就肯定属于某种品类# 只要是对象,就肯定有属性### 你是上帝## 地球## 山川,河流,大海,森林,## 飞禽 飞, 吃虫子,下蛋,# 布谷鸟 唱歌# 乌鸦## 几百种鸟 阅读全文
摘要:
__author__ = "Alex Li" class Animal: def __init__(self, name): # Constructor of the class self.name = name def talk(self): # Abstract method, defined 阅读全文
摘要:
__author__ = "Alex Li" class A: def __init__(self): print("A") class B(A): pass # def __init__(self): # print("B") class C(A): pass # def __init__(sel 阅读全文
摘要:
事例一 __author__ = "Alex Li" # class People: 经典类 class People(object): #新式类 def __init__(self,name,age): self.name = name self.age = age self.friends = 阅读全文
摘要:
dog.py __author__ = "Alex Li" class Dog: def __init__(self,name): self.name = name def bulk(self): print("%s: wang wang wang!" % self.name) d1 = Dog(" 阅读全文
摘要:
__author__ = "Alex Li" import time def consumer(name): print("%s 准备吃包子啦!" %name) while True: baozi = yield print("包子[%s]来了,被[%s]吃了!" %(baozi,name)) '' 阅读全文
摘要:
# __author__ = "Alex Li" # # #print( all([1,-5,3]) ) # #print( any([]) ) # # a= ascii([1,2,"开外挂开外挂"]) # # print(type(a),[a]) # # a = bytes("abcde",enc 阅读全文
摘要:
__author__ = "Alex Li" ''' def fib(max): #10 n, a, b = 0, 0, 1 while n < max: #n<10 #print(b) # 把fib函数变成generator,只需要把print(b)改为yield b就可以了 yield b a, 阅读全文
摘要:
test.text {"name": "alex", "age": 22}{"name": "alex", "age": 21} json序列化1.py __author__ = "Alex Li" #处理简单数据 import json info = { 'name':'alex', 'age': 阅读全文
摘要:
__author__ = "Alex Li" """ import time user,passwd = 'alex','abc123' def auth(auth_type): print("auth func:",auth_type) def outer_wrapper(func): def w 阅读全文