5 s
= "\13hello\14 \13world\14 " * 1000
6 p
= re
.compile(r
"([\13\14])")
7 timefunc(10, p
.sub
, "", s
)
8 timefunc(10, p
.split
, s
)
9 timefunc(10, p
.findall
, s
)
11 def timefunc(n
, func
, *args
, **kw
):
15 result
= func(*args
, **kw
)
21 print func
.__name
__, "%.3f" % (t1
-t0
), "CPU seconds"