Re: Formatted Integer With Specified Number Of Digits

Alan Bawden <[email protected]> Fri, 24 Oct 2025 06:38:05 -0400
Newsgroups comp.lang.python
Organization ITS Preservation Society
Message-ID <[email protected]>
Paul Rubin <[email protected]> writes:

   Lawrence D’Oliveiro <[email protected]> writes:
   >     >>> "%#0.3x" % 2
   >     '0x002'

   f'0x{2:03x}

Won't work for negative numbers.

-- 
Alan Bawden