Python自学-第11次作业
来源:互联网 发布:辞职 知乎 编辑:程序博客网 时间:2024/06/06 20:00
#coding=utf-8class test(object):#属性的装饰方法 #@property #@staticmethod # 静态方法,将命名空间中放入test函数 def d(self): return 4t = test()print t.d()class boy(object): gender = 1 def __init__(self,name): self.name = nameclass girl(object): gender = 0 def __init__(self,name): self.name = nameclass love: '''contain all love type''' def __init__(self,name_one,name_two): self.one = name_one self.two = name_two def meet(self): return "this is %s and %s loveing story !!" %(self.one,self.two)class Normal_love(love): def __init__(self,name_one,name_two): love.__init__(self,name_one,name_two) if name_one.gender + name_two.gender != 1: raise TypeError,'error not gay!!!!!'A = boy('A')B = girl('B')AandB = Normal_love(A,B)print AandB.meet()
0 0
- Python自学-第11次作业
- Python自学-第12次作业
- Python自学-第16次作业
- python自学-第八次作业
- Python自学--第九次作业
- 第11次作业
- 第11次作业
- 第11次课后作业
- 第7次作业
- 第6 次作业
- 第5次作业
- 第X次作业
- 第3次作业
- 第4次作业
- 第5次作业
- 第6次作业
- 第7次作业
- 第9次作业
- 写在汇编语言开课之前
- python中*args **kw到底是什么意思
- SQLiteOpenHelper的构造函数与实例方法
- 蓝桥杯 算法训练 Lift and Throw
- I/O多路复用之select
- Python自学-第11次作业
- typedef struct 和struct
- Spring boot、eureka服务注册与发现实例及注意事项说明
- java之泛型
- (转)Python中的map,reduce,filter,lambda内置函数
- Spark集群环境搭建
- Java反射机制,实现Excel的导入与导出
- 同步异步 串行 并行
- loadrunner不支持FILE数据类型