찾다

 >  Q&A  >  본문

python中name 'self' is not defined?

代码如下:报错为name 'self' is not defined,请问是什么原因?

class ListNode(object):
    def __init__(self, x):
        self.val = x
        self.next = None
阿神阿神2946일 전1121

모든 응답(1)나는 대답할 것이다

  • ringa_lee

    ringa_lee2017-04-18 09:54:00

    전체 코드가 게시되지 않는데 문제가 있는 걸까요?

    회신하다
    0
  • 취소회신하다