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

hlubenow hlubenow2 at gmx.net
Sun Apr 1 19:30:38 EDT 2007


Plissken.s at gmail.com wrote:

> 
> Hi,
> 
> how can i compare a string which is non null and empty?
> 
> 
> i look thru the string methods here, but cant find one which does it?
> 
> http://docs.python.org/lib/string-methods.html#string-methods
> 
> In java,I do this:
> if (str != null) && (!str.equals("")) ....
> 
> how can i do that in python?

What about

if str != "":
    pass

?



More information about the Python-list mailing list