Script Editor - If statement - String is NULL

Hi everybody,
I needed to compare a string with NULL or see if the string is empty.
I tried the python function .isNull() >> doesn’t works.
I tried isNull(string_to_compare) >> doesn’t works.
Finally I founded:
if (string_to_compare == None):

else:

Trying to help,

In python, null is None, and has no properties or methods of its own. The correct check is if something is None:

However, if you want empty to be treated the same, just do if something:. In a boolean context, empty strings and None both evaluate to False.

1 Like