7_19 day24 5min,4min

class Chinese:
country='China'
l=['a','b']
def __init__(self,name):
self.name=name

def play_ball(self,ball):
print('%s 正在打 %s' %(self.name,ball))
p1=Chinese('alex')
print(p1.l)
p1.l=[1,2,3]
print(Chinese.l)
print(p1.__dict__)//

['a', 'b']
['a', 'b']
{'name': 'alex', 'l': [1, 2, 3]}

 

class Chinese:
country='China'
l=['a','b']
def __init__(self,name):
self.name=name

def play_ball(self,ball):
print('%s 正在打 %s' %(self.name,ball))
p1=Chinese('alex')
p1.l.append('c')##换方式改
print(p1.__dict__)
print(Chinese.l)//

{'name': 'alex'}
['a', 'b', 'c']

 

posted @ 2018-07-19 07:47  一棵大树一棵小树一棵草  阅读(97)  评论(0编辑  收藏  举报