How to convert a string to hex?

Jens Arnfelt jens.arnfelt at wanadoo.dk
Thu Jun 29 09:17:10 EDT 2000


Is there any easy way to go the other way, like convert hex number
"0x26100511FFFF" to a string with the the following value: "26100511FFFF"
?

richard_chamberlain wrote:

> Hi Sam,
>
> import string
> b = "6b584"
> i=string.atoi(b,16)
> print hex(i)
>
> 0x6b584
>
> Richard
>
> Sam Wun <swun at esec.com.au> wrote in message
> news:3952EC0D.D5CF9066 at esec.com.au...
> > Suppose here is:
> >
> > b = "6b584"
> >
> > I would like to b to hex. Does anyone know how to do that in python?
> >
> >
> > Thanks
> > Sam.
> >
> >




More information about the Python-list mailing list