发布时间:2019-08-24 09:29:18编辑:auto阅读(2247)
https://blog.csdn.net/langb2014/article/details/54800203
---------------------------------------------------
补充:2018-09-24
---------------------------------------------------
Class 中的 def __init__(): 称为构造器/构造方法
super().__init__是调用父类的def __init__():
#!/usr/bin/python
# -*- coding: utf-8 -*-
class A(object):
def __init__(self, por):
self.por = por
print ("por", self.por)
class B(A):
def __init__(self,var):
super(B, self).__init__(var)
b = B(1)
print (b)
print (type(b))结果:
por 1 <__main__.B object at 0x7ff461949048> <class 'type'>
上一篇: python垃圾回收机制!
下一篇: python 读文件 如何从第二行开始
51295
50745
41342
38154
32624
29522
28372
23243
23211
21534
1608°
2342°
1942°
1883°
2213°
1929°
2613°
4390°
4233°
3005°