X
Xah Lee
Why is that some of my files written out by
outF.write(outtext.encode('utf-8'))
has ascii 10 as EOL, while others has ascii 13 as EOL?
both of these files's EOL are originally all ascii 10.
If i remove the EOL after the tt below in the place string, then this
doesn't happen.
findreplace = [
(ur'</body>',
ur'''tt
</body>'''),
]
....
inF = open(filePath,'rb')
s=unicode(inF.read(),'utf-8')
inF.close()
for couple in findreplace:
outtext=s.replace(couple[0],couple[1])
s=outtext
outF = open(tempName,'wb')
outF.write(outtext.encode('utf-8'))
outF.close()
thanks.
Xah
(e-mail address removed)
∑ http://xahlee.org/PageTwo_dir/more.html ☄
outF.write(outtext.encode('utf-8'))
has ascii 10 as EOL, while others has ascii 13 as EOL?
both of these files's EOL are originally all ascii 10.
If i remove the EOL after the tt below in the place string, then this
doesn't happen.
findreplace = [
(ur'</body>',
ur'''tt
</body>'''),
]
....
inF = open(filePath,'rb')
s=unicode(inF.read(),'utf-8')
inF.close()
for couple in findreplace:
outtext=s.replace(couple[0],couple[1])
s=outtext
outF = open(tempName,'wb')
outF.write(outtext.encode('utf-8'))
outF.close()
thanks.
Xah
(e-mail address removed)
∑ http://xahlee.org/PageTwo_dir/more.html ☄