iterating over lines in a file

nobody no at bo.dy
Mon Jul 24 08:39:22 EDT 2000


cjc26 at nospam.cornell.edu (Cliff Crawford), in
<slrn8nm1au.pod.cjc26 at synecdoche.sowrong.org>:

> Oh, right..I should've explained it better :)  A compiled regexp is an
> object which has match() and search() methods, so instead of
>     match=re.match(reg_c, test)
> you want to do
>     match=reg_c.match(test)

oy. i knew i was stupid, but now i know just *how* stupid. thanks, i
guess. X-)

> Also, in your example you'd probably want to use search() rather than
> match(), which only succeeds if the regexp matches the beginning of the
> string (i.e. it acts as if there is an implicit '^' at the beginning of
> the regexp).

hm. any difference in performance, or can i just as well make the caret
explicit and standardize myself on match?




More information about the Python-list mailing list