首页
mac
it
登录
6mi
u
盘
搜
搜 索
it
python 15.1类的特殊方法
python 15.1类的特殊方法
mac
2024-02-18
44
1、init是关键字
2、方法在对象创建时自动执行一次
3、
class person (): def __init__(self,name): self.name = name print("hello") def speak(self): print('我是%s'%self.name) p1 = person("钢铁侠") p1.speak()
转载请注明原文地址: https://mac.8miu.com/read-484801.html
最新回复
(
0
)