On Fri, Dec 23, 2011 at 3:22 AM, Stan Iverson <iversons...@gmail.com> wrote: > > On Thu, Dec 22, 2011 at 11:30 AM, Rami Chowdhury <rami.chowdh...@gmail.com> > wrote: >> >> Could you try using the 'open' function from the 'codecs' module? > > I believe this is what you meant: > > file = codecs.open(p + "2.txt", "r", "utf-8") > > but got this error: > > /usr/lib64/python2.4/codecs.py in next(self=<open file 'index2.txt', mode > 'rb'>)
Your file almost certainly isn't UTF-16, so don't bother trying that. I think you may have ISO-8859-1 encoding, also called Latin-1, but it's not easy to be sure. Try: file = codecs.open(p + "2.txt", "r", "iso-8859-1") ChrisA -- http://mail.python.org/mailman/listinfo/python-list