[Tutor] regexing and timing, seperatly
Galen O'Neil
goneil@scu.edu
07 Oct 2002 22:18:56 -0700
1. I can't seem to find a simple tutorial or example on timing. I want
an infinite loop but I don't want it to eat all my cpu time. I've
looked at a few programs that use tkinter and root.mainloop() but I
can't imagine there aren't some other ways that don't involve tkinter.
So if anybody knows where I can find a decent tutorial or has some
sample code, that would be great.
2. I'm taking data from a telnet session (using telnetlib) but I can't
seem to do regexs on it. Here's an example:
this result from this code:
print "***searching data, data at this moment contains***"
print data
import re
m = re.match("Player", data)
if m:
print 'Match found: ', m.group()
else:
print 'No match'
***searching data, data at this moment contains***
[0m[1;37m[0m
[0m[1;34m=======================[1;37m[0m[ God Wars : Rogue
Edition ][1;34m=======================[1;37m[0m[1;37m[0m
[0m[0m[0m[0m[0m[0m[0m [1;34m|[1;37m[0m
[1;36mAVATARS [1;34m-|[1;37m[0m
[0m[0m[0m[0m[0m[0m[0m[0m[0m[0;31mImmortal[1;37m[0m
[1;34m0.45 [1;37m[0m (Ronin) Wolfe the
mortal[1;37m[0m[1;37m[0m
[0mLogin Timer [1;34m0.00 [1;37m[0m {Yellow Invoker}
AutoKelvan tell me hi[1;37m[0m[1;37m[0m
[1;31mAvatar[1;37m[0m [1;34m0.00 [1;37m[0m {=Rogue
Lemure=} Shaddai the demonator[1;37m[0m[1;37m[0m
[0m [1;34m|[1;37m[0m
[1;36mMORTALS [1;34m-|[1;37m[0m
[0mMortal+ [1;34mNone
[1;37m[0m[1;37m[0m
Infuriater[1;36mSu[1;31mEs[1;37m[0m[1;37m[0m
Mortal+ [1;34mNone
[1;37m[0m[1;37m[0m Lerdos the
mortal[1;37m[0m[1;37m[0m
[0m[0m [1;34m|[1;37m[0m
[0m[1;34m===============================================================================[1;37m[0m[1;37m[0m
[0m[1;34m|[1;37m[0m Current [1;34m|[1;37m[0m Players Visible :
5 [1;34m|[1;37m[0m Arena Status : [0mChallenge In Progress
[1;34m|[1;37m[0m[1;37m[0m
[0m[1;34m|[1;37m[0m Stats [1;34m|[1;37m[0m Most Players :
21 [1;34m|[1;37m[0m Player Kills : 4491 [1;34m|[1;37m[0m Status
Kills : 2996 [1;34m|[1;37m[0m[1;37m[0m
[0m[1;34m===============================================================================[1;37m[0m[1;37m[0m
[0m[1;37m[0m
[0m<7970 qp> <[0;1;36m21000[0;0;37mH [0;1;36m22166[0;0;37mM
[0;1;36m4000[0;0;37mV>
No match
You may notice that the word player is in the string, but it still
returns no match. Any ideas?
--Modig