[Tutor] hex output

Brian Carlin kb6nvh at cox.net
Wed Sep 10 02:39:32 EDT 2003


I just came across your post about hex output.
The following Python commands work for me:

>>>  hex(65)[2:]
'41'
>>>  import string
>>>  string.zfill(hex(65)[2:],4)
'0041'
>>>

The second parameter of string.zfill() specifies the number of digits 
you want in the string.  If there are fewer digits, the function pads 
zeros to the left.



More information about the Tutor mailing list