Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #197572

Re: Formatted Integer With Specified Number Of Digits

Path csiph.com!eternal-september.org!feeder.eternal-september.org!bawden.eternal-september.org!.POSTED!not-for-mail
From Alan Bawden <alan@csail.mit.edu>
Newsgroups comp.lang.python
Subject Re: Formatted Integer With Specified Number Of Digits
Date Fri, 24 Oct 2025 06:38:05 -0400
Organization ITS Preservation Society
Lines 12
Message-ID <86ldl037qq.fsf@williamsburg.bawden.org> (permalink)
References <10d23rk$2bc2b$1@dont-email.me> <87ikg467io.fsf@nightsong.com>
MIME-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 8bit
Injection-Date Fri, 24 Oct 2025 10:38:06 +0000 (UTC)
Injection-Info bawden.eternal-september.org; posting-host="2a912a0185f3b5a34702990b731cf422"; logging-data="2664458"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/y10HDviop9RUspSP5uerm"
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)
Cancel-Lock sha1:Pn10XTXllwbjybvZrWJUTgDJGKg= sha1:/FvssGdCyrF7oLOK0y8npI5DGXk=
Xref csiph.com comp.lang.python:197572

Show key headers only | View raw


Paul Rubin <no.email@nospam.invalid> writes:

   Lawrence D’Oliveiro <ldo@nz.invalid> writes:
   >     >>> "%#0.3x" % 2
   >     '0x002'

   f'0x{2:03x}

Won't work for negative numbers.

-- 
Alan Bawden

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar


Thread

Formatted Integer With Specified Number Of Digits Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-10-19 07:26 +0000
  Re: Formatted Integer With Specified Number Of Digits Gilmeh Serda <gilmeh.serda@nothing.here.invalid> - 2025-10-19 09:17 +0000
  Re: Formatted Integer With Specified Number Of Digits songbird <songbird@anthive.com> - 2025-10-19 10:01 -0400
    Re: Formatted Integer With Specified Number Of Digits Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-10-19 21:39 +0000
  Re: Formatted Integer With Specified Number Of Digits Paul Rubin <no.email@nospam.invalid> - 2025-10-24 01:14 -0700
    Re: Formatted Integer With Specified Number Of Digits Alan Bawden <alan@csail.mit.edu> - 2025-10-24 06:38 -0400

csiph-web