
python
python
小尼ndq
炼丹师 C
展开
-
Python 继承(子类、父类) 构造函数(__init__ / super 关键字)
3种情况: 子类不重写init,继承父类init 子类重写init, 不继承父类init 子类重写init,同时继承父类init(super关键字) 情况1: 子类不重写 init,实例化子类时,自动调用父类定义的 init。 class Father(object): def __init__(self, name): self.name=name print ( "name: %s" %( self.name) ) def getName(self): return 'Fathe原创 2020-07-30 10:20:32 · 1232 阅读 · 0 评论 -
postgresql Python 简单应用
postgresql 可以在python下操作 次为一些简单操作 注意:user passward 要设置正确,不然连不上。 端口也要对应好 import psycopg2 # from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT # conn.set_isolation_level(ISOLATION_LEVEL_AUTOCOMMIT) user = "postgres" pwd = "123456" port = "5432" hos原创 2020-07-29 11:20:12 · 223 阅读 · 0 评论