class_init.py
来自「《简明 Python 教程》为 "A Byte of Python" 的唯一指定」· Python 代码 · 共 15 行
PY
15 行
#!/usr/bin/env python
# Filename: class_init.py
class Person:
def __init__(self,name):
self.name=name
def sayHi(self):
print 'Hello, my name is',self.name
p=Person('Swaroop')
p.sayHi()
# This short example can also be written as Person('Swaroop').sayHi()
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?