标签:
代码:
#BSF search class TreeNode: def _init_(self,x): self.val = x self.left = None self.right = None def kthSmallest(self, root, k): print x
结果:
>>> a = TreeNode(2) Traceback (most recent call last): File "<pyshell#142>", line 1, in <module> a = TreeNode(2) TypeError: this constructor takes no arguments >>> a = TreeNode() >>> a <__main__.TreeNode instance at 0x0000000002AC44C8> >>>
难道是因为def _init_里面不能有参数?
标签:
原文地址:http://www.cnblogs.com/wnan42/p/4676175.html