Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #11465 > unrolled thread
| Started by | Adam Tauno Williams <awilliam@whitemice.org> |
|---|---|
| First post | 2011-08-15 11:29 -0400 |
| Last post | 2011-08-15 11:29 -0400 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: string to unicode Adam Tauno Williams <awilliam@whitemice.org> - 2011-08-15 11:29 -0400
| From | Adam Tauno Williams <awilliam@whitemice.org> |
|---|---|
| Date | 2011-08-15 11:29 -0400 |
| Subject | Re: string to unicode |
| Message-ID | <mailman.14.1313423519.27778.python-list@python.org> |
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. codecs.open(filename, mode[, encoding[, errors[, buffering]]]) <http://docs.python.org/library/codecs.html#codec-objects> -- Adam Tauno Williams <awilliam@whitemice.org> LPIC-1, Novell CLA <http://www.whitemiceconsulting.com> OpenGroupware, Cyrus IMAPd, Postfix, OpenLDAP, Samba
Back to top | Article view | comp.lang.python
csiph-web