>> But, I still get this error: >> Traceback (most recent call last): >> ... >> UnicodeEncodeError: 'ascii' codec can't encode character u'\u201c' in >> position 76: ordinal not in range(128) >> What am I missing? > > Take a read through http://evanjones.ca/python-utf8.html which will give you > insight as to how you should be reading and processing your files.
in a similar vein, i wrote a shorter blog post awhile ago that focuses specifically on string processing: http://wesc.livejournal.com/1743.html ... in it, i also describe the correct way of thinking about strings in these contexts... the difference between a string that represents data vs. a "string" which is made up of various bytes, as in binary files. hope this helps! -- wesley - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - "Core Python Programming", Prentice Hall, (c)2007,2001 "Python Fundamentals", Prentice Hall, (c)2009 http://corepython.com wesley.j.chun :: wescpy-at-gmail.com python training and technical consulting cyberweb.consulting : silicon valley, ca http://cyberwebconsulting.com _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor