On 22/09/15 17:32, Oscar Benjamin wrote:

with open('input/PS06Test_100Packages.xml', 'r') as f1:
     with open('mod1.xml', 'a') as f2:
         for line in f1:
             s = '\x02' + line[:-1] + '\x03\n'

A further possibility is the [-1] is not stripping
the full EOL on your system.

Try using

line.rstrip()

instead, it should remove all non text characters.

Another random thought.
I'm playing catch up since I just returned from a week's vacation...


--
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

Reply via email to