reg exp and octal notation

Lucas Branca nospam at freeworld.fr
Fri Mar 5 16:31:19 CET 2004


-- snip --
>> ('\x06\x1cabc',) string from source code

>> ('\\006\\034abc\n',) same string read from file

--snip --
> In other words, the backslashes are seen as literal backslashes.
> readline() does no evaluation of the string, it just copies the
> characters

yeah... you are right guys. I have matched two problems
reg exp are innocents .

Ok. Let's say so:
I have to read each line of a file and strip a particular string from there
(a string containing octal notation too)

the problem is actually the file.readline() that doesn't return
what I was expected to.

pardon my 'newbyeeeee'  but is there a way to read a  line xy from that file
and obtaining:

line xy:       \006\034abc

('\x06\x1cabc',)

 and not every single char in it like now ?
('\\006\\034abc\n',)

(before I start to reinvent the wheel ....... :)  )

Thank you
Lucas





More information about the Python-list mailing list