arthor
2021-05-07 22:35
class animal(object):
pass dog=animal()cat=animal()
dog.name="xiaohuang"
dog.age='1'
cat.name='xiaohua'
cat.age='1.5'
print (dog.name)
print (dog.age)
print (cat.name)
print (cat.age)
class animal(object): pass dog=animal() cat=animal() dog.name="xiaohuang" dog.age='1' cat.name='xiaohua' cat.age='1.5' print (dog.name) print (dog.age) print (cat.name) print (cat.age)
class animal(object): pass dog=animal()cat=animal()dog.name="xiaohuang"dog.age='1'cat.name='xiaohua'cat.age='1.5'print (dog.name)print (dog.age)print (cat.name)print (cat.age)
print后面有空格
print(dog.name) print(dog.age) print(cat.name)
Python3 进阶教程(新版)
41910 学习 · 236 问题
相似问题