Matching Control Characters

Greg Lindstrom greg.lindstrom at novasyshealth.com
Mon Nov 1 11:24:47 EST 2004


Hello-

I have a text file generated on a HP-9000 running HP-Unix with embedded
control characters and would like to read it in, modify it, and write it out
in PDF format.  The new page character is control-L which I can match with
regular expressions as

/^M    (build using control-Q control-M)

but when I attempt to use this to match the string in the program using

if re.match('^M', input_line):    # using control-Q control-M
   # issue a page feed

it will not match (no new pages are generated).

I am opening and reading the input file in binary mode.  Anyone see what I'm
doing wrong?

Thanks!
--greg



Greg Lindstrom                                         (501) 975-4859
NovaSys Health                  greg.lindstrom at novasyshealth.com

"We are the music makers, and we are the dreamers of dreams"  W.W.





More information about the Python-list mailing list