最新回答 / hermaniu
Traceback (most recent call last):? File "C:\Users\hermaniu\Desktop\test1.py", line 162, in <module>? ? w=Work('Herman',96,'english',22)? File "C:\Users\hermaniu\Desktop\test1.py", line 156, in __init__? ? super(Work,self).__init__(name,score,course...
2021-11-23
最贊回答 / 慕粉_pp
關于調用兩種方法的時機使用print()時使用%s和f'{}'拼接對象時使用str(x)轉換對象x時在上述三種場景中,會優先調用對象的__str__()方法;若沒有,就調用__repr__()方法;若再沒有,則顯示其內存地址。特別地,對于下面兩種場景:用%r進行字符串拼接時用repr(x)轉換對象x時則會調用這個對象的__repr__()方法;若沒有,則不再看其是否有__str__()方法,而是顯示其內存地址。<...code...>
2021-11-20
最贊回答 / hermaniu
實例本身無count,get_count定義的是類方法,因此Leo.get_count()返回Animal的私有屬性__count=0,set_count是實例方法對類無效,因此獲取的__count 還是原本的0.
2021-11-18
最新回答 / 慕無忌1545359
class Animal(object):? ??? ? def __init(self,name,age,location):? ? ? ? self.__name = name? ? ? ? self.__age = age? ? ? ? self.__location = location? ? ? ??? ? def set_name(self,name):? ? ? ? self._name = name? ??? ? def get_name(self):? ? ? ? return self...
2021-11-17
已采納回答 / 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