1条回答 默认 最新
- qza2468 2021-11-12 19:45关注
class Song : name = '' singer = '' type = '' def __repr__(self): return "<<" + self.name + ">>" + "--" + self.singer + "#" + self.type Song s1, s2; s1.name = "Welcome to YouYour" s1.singer = 'taylor swift' s1.type = 'good' s2.name = "稻香" s2.singer = "周杰伦" s2.type = 'good' print(s1)
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报