encoding problem with BeautifulSoup - problem when writing parsed text to file

xDog Walker thudfoo at gmail.com
Thu Oct 6 15:22:06 EDT 2011


On Thursday 2011 October 06 10:41, jmfauth wrote:
> or  (Python2/Python3)
>
> >>> import io
> >>> with io.open('abc.txt', 'r', encoding='iso-8859-2') as f:
>
> ...     r = f.read()
> ...
>
> >>> repr(r)
>
> u'a\nb\nc\n'
>
> >>> with io.open('def.txt', 'w', encoding='utf-8-sig') as f:
>
> ...     t = f.write(r)
> ...
>
> >>> f.closed
>
> True
>
> jmf

What is this  io  of which you speak?

-- 
I have seen the future and I am not in it.




More information about the Python-list mailing list