string to unicode

Adam Tauno Williams awilliam at
Mon Aug 15 11:29:43 EDT 2011

On Mon, 2011-08-15 at 08:20 -0700, Artie Ziff wrote:
> if I am using the standard csv library to read contents of a csv file 
> which contains Unicode strings (short example: 
> '\xe8\x9f\x92\xe8\x9b\x87'), how do I use a python Unicode method such 
> as decode or encode to transform this string type into a python unicode 
> type? Must I know the encoding (byte groupings) of the Unicode? Can I 
> get this from the file? Perhaps I need to open the file with particular 
> attributes?

Open the file with a codec and pass that file-like object to csv., mode[, encoding[, errors[, buffering]]])


Adam Tauno Williams <awilliam at> LPIC-1, Novell CLA
OpenGroupware, Cyrus IMAPd, Postfix, OpenLDAP, Samba

More information about the Python-list mailing list