[Tutor] Matching string

govind goyal govindgoyal at gmail.com
Tue Feb 27 16:28:18 CET 2007


I want to use a pattern matcing (regular expression) inside "if loop" such
that if it will find "*MBytes*" and *"Mbits/sec"* both *at a time *regardless
of there position in a particular string ,then only it executes code inside
"if block".

for example if my string is  *"[904]  1.0- 2.0 sec  1.19 MBytes  10.0Mbits/sec
2.345 ms    0/  850 (0%)"* then if condition evalutes to TRUE and code
inside it will be executed.

If my string is *"Server listening on UDP port 5001"* then if condition
evaluates to False and code inside it will be not executed.

Can anybody help?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20070227/dc79e4e0/attachment.html 

More information about the Tutor mailing list