"Christian Witts" <cwi...@compuscan.co.za> wrote

You need a display function that can strip out the nulls as needed.
A simple list comprehension or generator expression would work
in this case:
print ' '.join(str(field) for field in data if field is not 'None')

The problem with that is if you're relying on a set delimiter you are removing elements so you would be better served by doing `str(field) if field != None else '' for field in record`

True, although in this case we do seem to have a fixed condition
since it's the database's representation of null but I originally didn't
notice the quotes around None. When I fixed that I should have
changed is to equals..

    print ' '.join(str(field) for field in data if field != 'None')

But your modification confuses me. can you explain?
What would the print line look like?

Alan G.

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to