number base conversion? (ASCII to Hex)

emile at fenx.com emile at fenx.com
Fri May 12 01:12:02 CEST 2000


Something like this?

>>> for i in "Testing 1,2,3 ":
	print "%2x" % ord(i),

54 65 73 74 69 6e 67 20 31 2c 32 2c 33 20

Emile van Sebille
emile at fenx.com


<chibaA at TinterlogD.Tcom> wrote in message
news:<391b2bd5.66612734 at news1.on.sympatico.ca>...
> How would I go about getting the base-16(hex) value of a character,
> into a string?
> 
> take character word[1] (for example)
> and retrieve the hex value of 31
> and assign it to value hexValue in an ascii format (ie. as the number
> 31).
> 
> 
> 
> -- 
> http://www.python.org/mailman/listinfo/python-list
>




More information about the Python-list mailing list