0
How to filter strings from a list of values?
values = [3, '2', '6'] var1 = [] for i in values: if type(i) == str: var1.append(i) #it works # but what if # the case is : values = [ none, W, e a t, '5', '0', 3]
2 Respuestas
+ 1
W is not a string But 'W' is a string
without quotes it is considered as a variable not string
hence the list values is not valid
+ 1
Should work too