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']