Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #41408

Re: Read utf-8 file

From Peter Otten <__peter__@web.de>
Subject Re: Read utf-8 file
Date 2013-03-18 11:37 +0100
Organization None
References <1f54b5e0-efac-4636-921d-aa087d05df44@a14g2000vbm.googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.3421.1363603041.2939.python-list@python.org> (permalink)

Show all headers | View raw


moonhkt wrote:

> How to display
> e4b8ad for 中 in python ?

Python 2

>>> print u"中".encode("utf-8").encode("hex")
e4b8ad


Python 3

>>> print(binascii.b2a_hex("中".encode("utf-8")).decode("ascii"))
e4b8ad

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Read utf-8 file moonhkt <moonhkt@gmail.com> - 2013-03-18 02:34 -0700
  Re: Read utf-8 file Peter Otten <__peter__@web.de> - 2013-03-18 11:37 +0100

csiph-web