Reputation: 199
i have this line:
logical= [value in line for value in Dictionnary["substance_name"].values]
that gave me this error:
TypeError: 'in <string>' requires string as left operand, not NoneType
This is probably due to some gaps in my dictionnary.
So to fix it I thought about adding this:
logical= [value in line for value in Dictionnary["substance_name"].values and value not None]
By the synthax seems to be incorrect. How can I express it correctly? I edited my code:
logical= [value in line for value in DictionnaireMedicHUG["substance_name"].values]
if logical != None:
I am still getting the same error
Upvotes: 0
Views: 71
Reputation: 404
Try this:
logical = [value in line for value in DictionnaireMedicHUG["substance_name"].values if logical is not None]
Upvotes: 1