tkFileDialog question

r rt8396 at gmail.com
Mon Nov 16 00:15:41 EST 2009


Matt,

There is also a nice thing you need to know about Python if you
already do not know. That is the fact that all empty collections bool
to False. This makes Truth testing easier.

>>> bool([])
False
>>> bool('')
False
>>> bool({})
False
>>> bool([1])
True
>>> bool([[]])
True
>>> bool(' ')
True

any empty collection, string, or 0 always bools to False.



More information about the Python-list mailing list