爲什麼這段代碼不起作用?繼承自python中的xmlrpclib.ServerProxy
#!/usr/bin/python2 from xmlrpclib import ServerProxy class ServerProxy1(ServerProxy): def __str__(self): return str(self.__host) proxy = ServerProxy1("http://workshop:58846/") print proxy
Original_ STR _:
def __repr__(self): return ( "" % (self.__host, self.__handler) ) __str__ = __repr__
結果:
File "/usr/lib/python2.7/xmlrpclib.py", line 793, in close raise Fault(**self._stack[0]) xmlrpclib.Fault: :method "_ServerProxy1__host.__str__" is not supported'>
「」「不起作用」意味着什麼? – 2011-04-12 13:53:02