On Dec 20, 12:30 pm, Neil Webster <[EMAIL PROTECTED]> wrote: > Hi All. > > I have a list which is a line from a file: > ['\x003\x008\x001\x004\x007\x005\x00.\x005\x000\x002\x005\x009\x009\x00', > '\x002\x001\x003\x006\x002\x002\x00.\x001\x007\x004\x002\x008\x002\x00'] > > This should be in the format: > ['381475.502599', '213622.174282'] > > I've tried a few options using replace (replacing "\x00" with "") and > trying to convert from hexademical to decimal. > > But nothing has worked. Can anybody give any tips to help?
Is your file utf-16 (that would explain why your file has \x00 in between every character)? If so, use codecs.open to read it, and you won't get the \x00's (you'll get a unicode string). Or you can remove them using replace: a = a.replace('\x00', '') HTH -- Paul Hankin -- http://mail.python.org/mailman/listinfo/python-list