Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #28198 > unrolled thread
| Started by | Tim Chase <python.list@tim.thechases.com> |
|---|---|
| First post | 2012-08-31 21:42 -0500 |
| Last post | 2012-08-31 21:42 -0500 |
| 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: how to get character hex number? Tim Chase <python.list@tim.thechases.com> - 2012-08-31 21:42 -0500
| From | Tim Chase <python.list@tim.thechases.com> |
|---|---|
| Date | 2012-08-31 21:42 -0500 |
| Subject | Re: how to get character hex number? |
| Message-ID | <mailman.18.1346467309.27098.python-list@python.org> |
On 08/31/12 21:21, contro opinion wrote:
>>>> for i in "english" :
> ... print(hex((ord(i))))
> ...
> 0x65
> 0x6e
> 0x67
> 0x6c
> 0x69
> 0x73
> 0x68
>>>> u"english".encode("utf-8")
> 'english'
>>>> u"english".encode("ascii")
> 'english'
>
> how can i get 656e676c697368 in encode method?
At least in 2.x, you can do:
>>> u"english".encode("hex")
'656e676c697368'
-tkc
Back to top | Article view | comp.lang.python
csiph-web