I am looking to make a comparison of a list with a list of lists. With this code I can do it between 2 lists but the problem happens when it is a list with a list of lists.
I am looking to edit my code to be corrected.
lista1=["paco","pepe","luis"]
lista2=["diego","mari","luis"]
comparacion = []
for item in lista1:
if item in lista2:
comparacion.append(item)
Code to correct:
lista1=["paco","pepe","luis"]
lista2=[["artur","2"],["paco","5"],["pepe","2"],["luis","2"],["beto","2"]]
comparacion = []
for item in lista1:
if item in lista2:
comparacion.append(item)
print comparacion
#Busco algo asi como respuesta:
>>>comparacion=[["paco","5"],["pepe","2"],["luis","2"]]