[Tutor] iterate problem

Michael P. Reilly arcege@shore.net
Wed, 19 Jul 2000 12:43:58 -0400 (EDT)


> > trying to write a simple script that removes the >>>'s from 
> > the beginning of lines in a text file 
> 
> Sounds like a job for reg expressions to me.
> 
> the regexp will be something like:
> 
> >[> ]+
> 
> which means a '>' followed by one or more '>' or spaces.

I think a more accurate one would be:
  r'^(> ?)+'

You want to anchor the regular expression to the beginning, and to
only strip off zero or one space (">" or "> "), still leaving the
other whitespace from the text (indentations for example).

  -Arcege

-- 
------------------------------------------------------------------------
| Michael P. Reilly, Release Manager  | Email: arcege@shore.net        |
| Salem, Mass. USA  01970             |                                |
------------------------------------------------------------------------