On 07/09/06, Anthra Norell <[EMAIL PROTECTED]> wrote: > s = '''<span class="sale"> > $14.99 > </span>, <span class="sale"> > $27.99 > </span>, <span class="sale"> > $66.99 > </span>, <span class="sale"> > $129.99 > </span>, <span class="sale"> > $254.99 > </span>''' > > >>> for line in [l.strip () for l in s.splitlines ()]: > if line [0] == '$': print line > > $14.99 > $27.99 > $66.99 > $129.99 > $254.99 > > Why parse? Why regular expressions? >
>>> print '\n'.join([i for i in s.splitlines() if i[0] == '$']) $14.99 $27.99 $66.99 $129.99 $254.99 and >>> print '\n'.join([i.strip() for i in s.splitlines () if i [0] == '$']) parses with no trailing whitespace :) -- http://mail.python.org/mailman/listinfo/python-list