On 22/09/15 15:44, richard kappler wrote:
gives me: line 1 starts with the \x02 hex then the line line 2 is the \xo3 hex alone line 3 starts with the \x02 hex then the line line 4 is the \x03 hex alone lather rinse repeat.
Silly possibility but are your lines fixed length? And if so might they be the width of your terminal/display so the lines are wrapping? Can you broaden the display to see if they unwrap? Just a wild idea...
So I mispoke, please accept my apology, it wasn't exactly the same result as my original code, it put the \x03 on it's own line. Oddly enough, I'm wondering if it's the xml that's making things screwy.
XML always makes things screwy since it doesn't have the concept of lines. If you are working with XML you should be parsing it using a proper XML parser (eg lxml) and reassembling it similarly. Thinking of XML and lines is nearly always a bad place to start. XML is a continuous text stream that sometimes is presented as a set of lines to humans. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor