Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #28198
| Date | 2012-08-31 21:42 -0500 |
|---|---|
| From | Tim Chase <python.list@tim.thechases.com> |
| Subject | Re: how to get character hex number? |
| References | <CA+YdQ_66ap1tQCRibdkntGvHqE1sp+Nv_kK2iiKh50GoAa=K6Q@mail.gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.18.1346467309.27098.python-list@python.org> (permalink) |
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 comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: how to get character hex number? Tim Chase <python.list@tim.thechases.com> - 2012-08-31 21:42 -0500
csiph-web