标签:pytho 面向对象 name python 对象 self person elf init
vim day6-5.py
#!/usr/bin/python # -*- coding:utf-8 -*- class Person(object): def __init__(self,name): #初始化函数,其实初始化已经执行了 self.name = name def say_name(self): print "My name is %s" % self.name p1=Person("gf1") #实例化 p2=Person("gf2") p1.say_name()
标签:pytho 面向对象 name python 对象 self person elf init
原文地址:http://www.cnblogs.com/minseo/p/6870257.html