I have two lists of different sizes. The first is a list of lists. Where I need to compare the type of elements in that first list list with another list that contains data type (str, int, float, ..).
Example:
lista1 = [['a', 'bb', 1.5, 3, 'a'],['h', 'oo', 9.6, 2, 'n'],...,['u', 'pp', 2.9, 1, 'j']]
lista2 = ['str', 'str', 'float', 'int', 'str']
I'm doing this:
for linha in range(0,68):
for linha2 in range(0,11):
if(type(lista1[linha2][linha]) != lista2[linha]):
print("Alguma coisa")
But it is not working because it returns:
int, <class 'int'>
So it does not recognize as equal but rather as different. How can I do it?