如何使用python group-by检索不区分大小写的单词?

2024-09-27 09:36:11 发布

您现在位置:Python中文网/ 问答频道 /正文

things=[("red",1),("red",2),("green",5),("green",10),("red",15)]
for key,value in groupby(things,lambda x:x[0]):
    for thi in value:
        if(b==key):
            print("things present in:",thi[1])

Tags: lambdakeyinforifvaluegreenred

热门问题