已采纳回答 / 慕前端7080484
直接输入变量,调用的是__repr__()方法,而__repr__()用于显示给开发人员。而当使用str()时,实际调用的是__str__()方法,所以要用str()来转换。下载视频
2022-03-04
已采纳回答 / Neutrons
client.pyclient.send(bytes('a', encoding='utf-8'))为什么要一直发送a?client.send(bytes(content, encoding='utf-8'))这样才能发送输入的内容server.pyserver.bind(('10.20.132.191', 8999))可以改为server.bind(('0.0.0.0', 8999))下载视频
2021-11-16
已采纳回答 / qq_hush_ceklpC
class Animal(): passdog = Animal()cat = Animal()print(dog)print(cat)print(dog == cat)
2021-07-09
已采纳回答 / 柳随风
calss Anmial(object): def __init__(self,name,age): self.name = name self.age = agedog = Anmial('Tim',4)cat = Anmial('Aim',5)print(dog.name)print(dog.age)print(cat.name)print(cat.age)<...code...>
2021-01-23
已采纳回答 / 柳随风
calss Anmial(object): count = 0 def __init__(self,name,age): self.name = name self.age = age Animal.count =Animal.count + 1dog = Animal('wangwang',1)print(Animal.count)cat = Animal('mimi',3)print(Animal.count)pig ...
2021-01-23
已采纳回答 / 柳随风
calss Animal(object): def __init__(self,name,age) self.name = name self.age = age dog = Animal('Tim',4) cat = Animal('Aim',5) print(dog.name) print(dog.age) print(cat.name) print(cat.age)<...code...>
2021-01-22
已采纳回答 / 粗实而夜雨
给出的Animal类里面并没有具体的初始化内容,只是调用了pass函数,所以会报错,你把pass里的内容替换下,def __init__(self,name,age) 就可以了
2021-01-20