小编gia*_*ele的帖子

初始化set()作为函数的参数

我有一个递归函数,它接受一个新set()的参数.这是功能:

def attributes(node, set):
    set.add(node.tag)
    if not node.istext():
        for n in node.content:
            set = set.intersection(attributes(node, set()))
    return set
Run Code Online (Sandbox Code Playgroud)

但我得到这个错误:

error -> TypeError
'set' object is not callable
Run Code Online (Sandbox Code Playgroud)

python python-3.x

0
推荐指数
1
解决办法
75
查看次数

标签 统计

python ×1

python-3.x ×1