Python不特定个数列表比较,返回参与比较列表元素的有无

def listCompare(*args):
    res = []
    listall = []
    for i in range(len(args)):
        listall += args[i]
    listall = list(set(listall))
    listall.sort()
    for item1 in listall:
        reslist = []
        reslist.append(item1)
        for j in range(len(args)):
            if item1 in args[j]:
                reslist.append("有")
            else:
                reslist.append("無")
        res.append(reslist)
    return res

 

上一篇:Posix消息队列


下一篇:【Java】通过一个算法题查漏补缺