Reputation: 1440
I am writing to a csv file in Python. But when I try to open and read it I get:
TypeError: expected string or Unicode object, NoneType found
My question is, how can I check before I write something whether my string contains a None type value.
Thanks
Upvotes: 0
Views: 1984
Reputation: 34146
You can use is not
(which is recommended to compare with singletons like None
):
if some_string is not None:
# write
Upvotes: 2