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


Groups > comp.lang.python > #28208 > unrolled thread

Re: how to get character hex number?

Started byMark Lawrence <breamoreboy@yahoo.co.uk>
First post2012-09-01 09:49 +0100
Last post2012-09-01 09:49 +0100
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.


Contents

  Re: how to get character hex number? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-09-01 09:49 +0100

#28208 — Re: how to get character hex number?

FromMark Lawrence <breamoreboy@yahoo.co.uk>
Date2012-09-01 09:49 +0100
SubjectRe: how to get character hex number?
Message-ID<mailman.28.1346489343.27098.python-list@python.org>
On 01/09/2012 04:50, Tim Chase wrote:
>
> Well, in 3.1.3 at least, using the u"..." notation dies on me with
> an invalid syntax.  However, as Ian suggests, you can do
>
>    my_str = "english"
>    "".join("%02x" % c for c in my_str.encode("ascii"))
>
> or whatever other encoding you want instead of "ascii".
>
> -tkc
>
>

The u"..." notation has been reintroducd for Python 3.3 see 
http://docs.python.org/dev/whatsnew/3.3.html#pep-414-explicit-unicode-literals

-- 
Cheers.

Mark Lawrence.

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web