I'm trying to write a Python 3 function that will filter a list and pop() all items that are a string. But when I try to write the following function:
def filter_list(l):
for i in l:
type_item = type(l[i])
if type_item == "class str":
l.pop(i)
return l
I get an error saying:
File "/home/codewarrior/solution.py", line 3, in filter_list
type_item = type(l[i])
TypeError: list indices must be integers or slices, not str
I believe that the return of this method is not a str, but I haven't found any documentation that tells me how I can check if the return is a string or not. Thank you!