标签:short hello eth self bin als comment on() usr
#!/usr/bin/python
# Filename: method.pyclass
Person
:
def
sayHi
(self):
print
‘Hello, how are you?‘
p = Person()
p.sayHi()# This short example can also be written as Person().sayHi()
这里我们看到了self
的用法。注意sayHi
方法没有任何参数,但仍然在函数定义时有self
。
标签:short hello eth self bin als comment on() usr
原文地址:http://www.cnblogs.com/nku-wangfeng/p/7689972.html