Home  >  Q&A  >  body text

python中name 'self' is not defined?

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

class ListNode(object):
    def __init__(self, x):
        self.val = x
        self.next = None
阿神阿神2741 days ago1032

reply all(1)I'll reply

  • ringa_lee

    ringa_lee2017-04-18 09:54:00

    The code is not posted in full or something?

    reply
    0
  • Cancelreply