Checking if elements are empty

Chris Mellon arkanes at gmail.com
Wed Sep 5 10:36:51 EDT 2007


On 9/5/07, Steve Holden <steve at holdenweb.com> wrote:
> Doran, Harold wrote:

> >
> > Is there a way to check if the first element of y is null?
> >
>
> len(y[0]) == 0
>
> would be the obvious way, assuming "null" means "the null string".
>

Better spelled as

if y[0]:



More information about the Python-list mailing list