tricky regular expressions
Petr Jakes
petr at tpc.cz
Tue Feb 7 17:32:09 EST 2006
try to google for "finit state machine" OR "state machine" OR FSM
titles =["USELESS DATA","Request : Play",
"USELESS DATA","Title: Beethoven's 5th",
"USELESS DATA","Request : next","USELESS DATA",
"Title: song# 2 ","USELESS DATA","Request : Play",
"USELESS DATA","Title: Beethoven's 5th",
"USELESS DATA","Request : next","USELESS DATA",
"Title: song# 3 ","USELESS DATA","Request : Play"]
for title in range(len(titles)):
if titles[title][:6] =="Title:":
x=1
try:
while titles[title+x]!="Request : Play" and
titles[title+x]!="Request : next":
x+=1
pass
print titles[title], titles[title+x]
except IndexError: pass
HTH
Petr Jakes
PS: just wonder why are you asking the same question in two different
topics....
More information about the Python-list
mailing list