[IPython-user] How to display the content of a string in hexadecimal format?
mark starnes
m.starnes05@imperial.ac...
Sun Sep 7 04:51:58 CDT 2008
A scroogle seach of, 'python hexadecimal', returned,
http://www.daniweb.com/code/snippet397.html
>From that, you could start with,
In [28]: int('a', 16)
Out[28]: 10
For a string like that,
In [31]: b=[]
In [32]: for i in 'abc':
....: b.append(int(i, 16))
....:
....:
In [33]: b
Out[33]: [10, 11, 12]
BR,
Mark.
ray wrote:
> For example, if the content of a string is 'abc', I want to a output
> like 414243. Is there a easy way? Thanks in advance.
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> IPython-user mailing list
> IPython-user@scipy.org
> http://lists.ipython.scipy.org/mailman/listinfo/ipython-user
More information about the IPython-user
mailing list