Looking for Form Feeds

Greg Lindstrom greg.lindstrom at novasyshealth.com
Mon Jan 24 22:32:29 CET 2005


Hello-
I have a file generated by an HP-9000 running Unix containing form feeds 
signified by ^M^L.  I am trying to scan for the linefeed to signal 
certain processing to be performed but can not get the regex to "see" 
it.  Suppose I read my input line into a variable named "input"

The following does not seem to work...
input = input_file.readline()
if re.match('\f', input): print 'Found a formfeed!'
else: print 'No linefeed!'

I also tried to create a ^M^L (typed in as <ctrl>Q M <ctrlQ> L) but that 
gives me a syntax error when I try to run the program (re does not like 
the control characters, I guess).  Is it possible for me to pull out the 
formfeeds in a straightforward manner?

Thanks!
--greg

-- 
Greg Lindstrom               501 975.4859
Computer Programmer          greg.lindstrom at novasyshealth.com
NovaSys Health
Little Rock, Arkansas

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

Confidentiality Notice
----------------------
This email and any attachments to it are privileged and confidential and are intended solely for use of the individual or entity to which they are addressed. If the reader of this message is not the intended recipient, any use, distribution, or copying of this communication, or disclosure of all or any part of its content to any other person, is strictly prohibited. If you have received this communication in error, please notify the sender by replying to this message and destroy this message and delete any copies held in your electronic files. Thank you.




More information about the Python-list mailing list