Mike Meyer <[EMAIL PROTECTED]> wrote: ... > A third alternative is to split once, then split the substrings a > second time and stitch the results back together: > > >>> sum([x.split('_') for x in mystr.split()], []) > ['this', 'NP', 'is', 'VL', 'funny', 'JJ'] > > Which is probably slow. To bad extend doesn't take multiple arguments.
Using sum on lists is DEFINITELY slow -- avoid it like the plague. If you have a list of lists LOL, DON'T use sum(LOL, []), but rather [x for x in y for y in LOL] Alex -- http://mail.python.org/mailman/listinfo/python-list