char string 2 hex string

A

Antonio Chay

Hello!

I need to transform a string from a file into a hexadecimal
representation, for example:

"AAA" should be "414141"

With perl I do this with:

unpack("H*","AAA")

And with python I got this:

"".join([str(hex(ord(x)))[2:] for x in "AAA"])

But seems a little "weird" for me.

Is there another way?
Thanks in advance!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top