How can i compare a string which is non null and empty
grante at visi.com
Mon Apr 2 04:56:49 CEST 2007
On 2007-04-02, Shane Geiger <sgeiger at ncee.net> wrote:
>>> how can i compare a string which is non null and empty?
>>> In java,I do this:
>>> if (str != null) && (!str.equals("")) ....
>>> how can i do that in python?
>> If you want to litterally do that, it's
>> if (str != None) and (str != ""):
>> However, the standard idiom for doing that in Python is
>> if str:
> It is probably worth noting that the example is not executable code:
> str() is a function.
Yea, sorry about that.
Grant Edwards grante Yow! Now I'm concentrating
at on a specific tank battle
visi.com toward the end of World
More information about the Python-list