Quick Question

Bruno Desthuilliers bdesth.quelquechose at free.quelquepart.fr
Fri Jun 23 01:24:23 CEST 2006

xkenneth a écrit :
> I want to be able to cycle through an array and print something in
> hexadecimal. Such as this
> thisArray = ["AF","0F","5F"]
> for x in range(len(thisArray)):
>            print "\x" + thisArray[x]
> However python chokes on the escaped identifier, how can I get around
> this?

Either by escaping the backslash:
   print "\\x"
or by using a raw string:
   print r"\x"

More information about the Python-list mailing list