Re: Testing for Null?

2008-06-29 Thread Chris
On Jun 29, 3:12 am, c0mrade <[EMAIL PROTECTED]> wrote: > Try something like this... > > list = ['lkdfjsldk', None, '', '0', 'slfkjsdlfj', 'lsdgjdlfg', False, True] > for n, it in enumerate(list): >     if not it: print 'Error on this definition' >     else: print '%d. %s' % (n+1, it) > > Results: >

Re: Re: Testing for Null?

2008-06-28 Thread Alex Bryan
Ya, I tried your code, it still did the same thing :[. I mean it worked like before. Some extra info about it, I am using BeautifulSoup to get definitions of words and well, the problem is it doesn't get links or anything in bold or italics. So the think #6 actually was, was italics. So I am still

Re: Testing for Null?

2008-06-28 Thread c0mrade
Try something like this... list = ['lkdfjsldk', None, '', '0', 'slfkjsdlfj', 'lsdgjdlfg', False, True] for n, it in enumerate(list): if not it: print 'Error on this definition' else: print '%d. %s' % (n+1, it) Results: 1. lkdfjsldk Error on this definition Error on this definition 4. 0 5

Re: Testing for Null?

2008-06-28 Thread Terry Reedy
Alex Bryan wrote: I am having a problem with a list value that is empty. I have a list of definitions called mainList. the 5th value in the list doesn't have anything in it. In this case, the values are definitions; also, in this case just the word cheese is defined. Here is my output to the