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])
答案 0 :(得分:1)
只需将casefold
添加到字符串中即可。
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.casefold() == key.casefold():
print("things present in: ", thi[1])