Looking for Form Feeds
Terry Hancock
hancock at anansispaceworks.com
Mon Jan 24 18:01:33 EST 2005
On Monday 24 January 2005 03:32 pm, Greg Lindstrom wrote:
> 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?
I suspect you should convert that to hexadecimal codes: '\x0c\x0b'
(at least I *think* those are the characters you mean, I'm not really
familiar with the ^X notation). That would be the simplest solution,
probably. Anytime I get into unprintable characters, I like to switch
to hex.
So you could just do something like:
pages = open('myfile.dat', 'rb').read().split('\x0c\x0b')
to load each page into a list, for example.
HTH,
Terry
--
--
Terry Hancock ( hancock at anansispaceworks.com )
Anansi Spaceworks http://www.anansispaceworks.com
More information about the Python-list
mailing list