Diez B. Roggisch wrote:
Pat wrote:

I have written chunks of Python code that look this:

     new_array = []
     for a in array:
         if not len( a ):
             continue
         new_array.append( a )

new_array = [a for a in array if len(a)]
and...

     string = ""
     for r in results:
         if not r.startswith( '#' ):
             string =+ r


"".join(r for r in results if not r.startswith("#"))

Diez


Thank you very much! That's exactly what I was looking for. That's much cleaner than my code.

This is a great forum and I really appreciate everyone's help.
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to