How to guard against nulls in python -


in python, how check if string either null or empty?

in c# have string.isnullorempty(some_string)

also, i'm doing regex like:

p = re.compile(...)  = p.search(..).group(1) 

this break if group doesn't have @ index 1, how guard against ? i.e. how re-write 2 lines safely?

just check it. explicit better implicit, , 1 more line won't kill you.

a = p.search(...) if not none:     # ... 

Comments

Popular posts from this blog

delphi - TJvHidDeviceController "DevicePath" always showing "\" -

Disabling Android home button for industry application -

asp.net mvc 3 - Unexpected "foreach" keyword after "@" character -