[Tutor] regexp help

Botykai Zsolt zsolt.botykai at online.hu
Wed Sep 22 16:18:49 CEST 2004


Hi for everyone,
just dived in to regexp, and have some problem, wrote this script to work as a 
pipe for multiline text input.

My problem is
- how to cut out all the empty lines (empty line: content only space or tab) 
from f_body?

import sys
import re
data = sys.stdin.read()
...
match_body = re.compile(
        r"""--==--==--==--==--.(.+).--==--==--==--==--""",
        re.DOTALL |
        re.MULTILINE |
        re.VERBOSE)
f_body = match_body.search(data)
f_body = match_body.search(data)
o_output = f_body.group(0)
...
sys.stdout.write(o_output)

Thx for any help,
Zsoltik@ from Hungary
(sorry about the disclaimer...)

--------------------------------------------------------------------------

Opinions, conclusions and other information in this message that do not
relate to the official business of Online Business Technologies Corp.
shall be understood as neither given nor endorsed by it. In such cases
Online Business Technologies Corp. will not bear the responsibility of
consequences.
If you have received this communication in error, please notify the
system manager immediately by responding to this email and then delete
it from your system.


A levelben foglalt, nem az Online Rt. hivatalos uzletmenetevel kapcsolatos
velemenyek vagy mas informaciok vonatkozasaban az Online Rt. nem vallal
felelosseget.
Amennyiben a level valamely hiba folytan jutott Onhoz, kerjuk, hogy
valaszlevelben azonnal ertesitse a rendszer uzemeltetojet, majd torolje ki
a levelet rendszerebol!



More information about the Tutor mailing list