How can i compare a string which is non null and empty

tac-tics tactics40 at gmail.com
Sun Apr 1 21:27:59 EDT 2007


str != ""

returns true if str is NOT the empty string.


str is not None

returns true if str is null (or None as it's called in python).

To check to make sure a string is nonnull and nonempty, do:

str is not None and str != ""




More information about the Python-list mailing list