On Wed, 2008-03-12 at 15:29 -0500, Michael Wieher wrote:
> Hey all,
> 
> I have these annoying textilfes that are delimited by the ASCII char
> for << (only its a single character) and >> (again a single character)
> 
> Their codes are 174 and 175, respectively.
> 
> My datafiles are in the moronic form
> 
> X<<Y>>Z

Those are decidedly not ASCII codes, since ASCII only goes to 127.

The easiest approach is probably to replace those markers with some
other characters that occurs nowhere else, for example good old NUL, and
then split on that:

line = line.replace(chr(174), "\0")
line = line.replace(chr(175), "\0")
result = line.split("\0")

HTH,

-- 
Carsten Haese
http://informixdb.sourceforge.net


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to