On 22 July 2013 13:45, Marc Tompkins <[email protected]> wrote:
>
> inFileName = "/Users/Marc/Desktop/rsp/tree.txt"
> with open(inFileName, 'r') as inFile:
> inString = inFile.read().decode('cp437')
> print inString
>
> I already tried something similar and got an error:
with open('../pytree.txt') as pytree, open('newpytree.txt','w') as pyout:
for line in pytree:
for char in line:
newchar = char.decode('cp437')
pyout.write(newchar)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2502' in
position 0: ordinal not in range(128)
What's my error here, since I want to write to a file. I have python(x,y)
so printing that is kind of time-taking and not too illuminating ;')
Jim
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor