Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #197568
| Path | csiph.com!weretis.net!feeder8.news.weretis.net!feeder2.feed.ams11.usenet.farm!feed.usenet.farm!peer03.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!fx17.ams4.POSTED!not-for-mail |
|---|---|
| From | Gilmeh Serda <gilmeh.serda@nothing.here.invalid> |
| Subject | Re: Formatted Integer With Specified Number Of Digits |
| Newsgroups | comp.lang.python |
| References | <10d23rk$2bc2b$1@dont-email.me> |
| MIME-Version | 1.0 |
| x-no-archive | yes |
| User-Agent | Pan/0.164 (Kupiansk) |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | 8bit |
| Lines | 21 |
| Message-ID | <k02JQ.19870$UXx1.12020@fx17.ams4> (permalink) |
| X-Complaints-To | abuse@easynews.com |
| Organization | Easynews - www.easynews.com |
| X-Complaints-Info | Please be sure to forward a copy of ALL headers otherwise we will be unable to process your complaint properly. |
| Date | Sun, 19 Oct 2025 09:17:04 GMT |
| X-Received-Bytes | 1042 |
| Xref | csiph.com comp.lang.python:197568 |
Show key headers only | View raw
On Sun, 19 Oct 2025 07:26:44 -0000 (UTC), Lawrence D’Oliveiro wrote:
> Why not?
I have no idea
you could try zfill:
>>> f"magic number: {'42'.zfill(4)}"
'magic number: 0042'
>>> f"magic number: {str(42).zfill(4)}"
'magic number: 0042'
more info:
https://fstring.help/cheat/
--
Gilmeh
Necessity is a mother.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar
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