[Tutor] ok

S A buc40@bemail.org
Tue, 3 Sep 2002 11:00:24 -0700


I get the following when I run the program:

found close
Connected for 40
found close
Connected for 197
found close
Connected for 228
found close
Connected for 43

Is this what you are looking for? What problems are you having?

A little more data and we will see if we can help you some.

Thanks.
SA

>Reply-To: "Morne" <fromclay@maxitec.co.za>
> "Morne" <fromclay@maxitec.co.za> "python tutor" <tutor@python.org> [Tutor] okDate: Tue, 3 Sep 2002 12:22:01 +0200
>
>ok my log file is saved in C:\my documents\ppp.log
>
>Can you run the program on you python and see where i went wrong.
>
>
>
>import re
>import string
>
>secondsMatcher=re.compile("Connect time: (\d+) secs")
>
>def getStuff(file):
>    closeline = 0
>    errorcount = 0
>    secondscount = 0
>    connectcount = 0
>    data_outcount = 0
>    data_incount = 0
>    ppplist = file.readlines()
>
>    for line in ppplist:
>
>      if string.find(line,"LayerUp") >= 0:
>          connectline = string.split(line)
>          connectcount = connectcount + 1
>
>      elif string.find(line,"ERROR") >= 0:
>          print "found error"
>          errorcount = errorcount + 1
>
>      elif string.find(line,"Connect time") >= 0:
>          print "found close"
>          connectSecs=secondsMatcher.search(line).group(1)
>          print "Connected for",connectSecs
>          closeline = string.split(line)
>          secondscount = secondscount + string.atoi(connectSecs)
>
>def main():
>    f=open("C:\my documents\ppp.log","r")
>    getStuff(f)
>    return None
>
>if __name__=="__main__":
>    main()
>
>
><< msg2.html >>
><< ppp.log >>



"I can do everything on my Mac that I used to do on my PC, plus alot more ..."

-Me

------------------------------------------------------------
Free, BeOS-friendly email accounts: http://BeMail.org/
BeOS News and Community: http://www.BeGroovy.com/


---------------------------------------------------------------------
Express yourself with a super cool email address from BigMailBox.com.
Hundreds of choices. It's free!
http://www.bigmailbox.com
---------------------------------------------------------------------