Ah! A list comprehension. Not at that point in the learning python book,
yet, but I will be soon. Thanks!
Don

On Tue, Jul 8, 2008 at 9:34 PM, Kent Johnson <[EMAIL PROTECTED]> wrote:

> On Tue, Jul 8, 2008 at 6:35 PM, Don Jennings <[EMAIL PROTECTED]> wrote:
>
> >     def __unicode__(self):
> >         l=[self.first_name, self.last_name, self.email, self.phone]
> >         res=[]
> >
> >         for x in l:
> >             if x != '':
> >                 res.append(x)
> >
> >         return ';'.join(res)
>
> return ';'.join(x for x in l if x)
> will work.
>
> Kent
>
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to