Writing a Carriage Return in Unicode
Doug
caldwellinva at verizon.net
Wed Nov 18 19:14:13 EST 2009
Hi!
I am trying to write a UTF-8 file of UNICODE strings with a carriage
return at the end of each line (code below).
filOpen = codecs.open("c:\\temp\\unicode.txt",'w','utf-8')
str1 = u'This is a test.'
str2 = u'This is the second line.'
str3 = u'This is the third line.'
strCR = u"\u240D"
filOpen.write(str1 + strCR)
filOpen.write(str2 + strCR)
filOpen.write(str3 + strCR)
filOpen.close()
The output looks like
This is a test.âThis is the second line.âThis is the third
line.â when opened in Wordpad as a UNICODE file.
Thanks for your help!!
More information about the Python-list
mailing list