[Tutor] findall()

Alan Gauld alan.gauld at blueyonder.co.uk
Sat Jul 3 19:10:49 EDT 2004


> def getlog(activity,type,endtype):
>     log = open("Multivert_Log.txt","r")
>     for line in log.readlines():
>         ac = re.compile(activity)

This creates an re object so you want to call the findall method 
of the ac object

>         fac = re.findall(ac, line)

So this becomes
          fac = ac.findall(line)

Same with the ty and ex bits further down.

Alan G.





More information about the Tutor mailing list