缺少1个必要的位置参数'b'

时间:2016-03-20 15:23:21

标签: python list

import re
class work:

    def a(self, i):
            i = 10
            j = 12

            self.i = i
            self.match(i)

            self.j = j
            self.match(j)


    def match(self, a, b):
            print("this is I", a) 
            print("this is J", b)

x = work()
x.a(0)

self.match(i)
TypeError: match() missing 1 required positional argument: 'b'

尝试导入ij进行匹配!任何帮助

1 个答案:

答案 0 :(得分:1)

您在函数定义中给出了两个参数:

 def match(self, a, b):
    print("this is I", a) 
    print("this is J", b)

,但只打了一个电话:

 self.match(j)