[Tutor] hex output

A.M. Kuchling amk at amk.ca
Thu Sep 4 13:48:27 EDT 2003


On Thu, Sep 04, 2003 at 06:55:22PM +0530, Jimmy verma wrote:
>I want to write it in 4 digits form like this  0041
>and also in upper cases.

Use the string formatting operator %:  

>>> '%04X' % 45677
'B26D'

--amk



More information about the Tutor mailing list