And if you want to select a set number of words rather than characters, you 
could use a regular expression. Something like:

import re
first_words = re.compile(r'(\w+\W+|\w+$'){,10}')
for r in records:
    r.description = first_words.match(r.description).group()

Anthony

On Tuesday, September 27, 2011 8:50:48 AM UTC-4, selecta wrote:
>
>
>
> db.define_table('person',Field('name'),Field('description','text'),Field('sex'))
>  
>
>
> records = db(...).select(..., limitby=(0, 5))
> for r in records:
>     r.description = '%s%s'%(r.description[:10],'...' if 
> len(r.description)>10 else '')
>

Reply via email to