Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #11465
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <awilliam@whitemice.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'example:': 0.03; 'transform': 0.07; 'python': 0.08; 'csv': 0.09; 'file-like': 0.09; 'postfix,': 0.09; 'subject:string': 0.09; 'library': 0.15; 'adam': 0.16; 'codec': 0.16; 'cyrus': 0.16; 'encode': 0.16; 'from:addr:awilliam': 0.16; 'from:addr:whitemice.org': 0.16; 'from:name:adam tauno williams': 0.16; 'message-id:@linux- yu4c.site': 0.16; 'received:72.14.190': 0.16; 'received:72.14.190.87': 0.16; 'received:mail.wmmi.net': 0.16; 'received:wmmi.net': 0.16; 'reply-to:addr:awilliam': 0.16; 'reply- to:addr:whitemice.org': 0.16; 'subject:unicode': 0.16; 'mon,': 0.16; 'wrote:': 0.16; 'header:In-Reply-To:1': 0.22; 'string': 0.26; 'received:72.14': 0.26; 'pass': 0.29; 'unicode': 0.29; 'url:library': 0.31; 'to:addr:python-list': 0.33; 'object': 0.35; 'file': 0.36; 'url:python': 0.36; 'using': 0.37; 'open': 0.37; 'url:org': 0.38; 'subject:: ': 0.39; 'received:192': 0.39; 'url:docs': 0.39; 'header:Mime-Version:1': 0.39; 'to:addr:python.org': 0.39; 'williams': 0.66; 'header:Reply-To:1': 0.71; 'reply-to:no real name:2**0': 0.71; 'novell': 0.84; 'samba': 0.84 |
| Subject | Re: string to unicode |
| From | Adam Tauno Williams <awilliam@whitemice.org> |
| To | python-list@python.org |
| Date | Mon, 15 Aug 2011 11:29:43 -0400 |
| In-Reply-To | <4E493936.5030807@gmail.com> |
| References | <4E493936.5030807@gmail.com> |
| Content-Type | text/plain; charset="UTF-8" |
| X-Mailer | Evolution 3.0.2 |
| Content-Transfer-Encoding | 7bit |
| Mime-Version | 1.0 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| Reply-To | awilliam@whitemice.org |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.14.1313423519.27778.python-list@python.org> (permalink) |
| Lines | 20 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1313423519 news.xs4all.nl 23913 [2001:888:2000:d::a6]:53982 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:11465 |
Show key headers only | View raw
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 comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: string to unicode Adam Tauno Williams <awilliam@whitemice.org> - 2011-08-15 11:29 -0400
csiph-web