Re: Formatting a str as a number - Okay, one more related thing...

Liste des GroupesRevenir à cl python 
Sujet : Re: Formatting a str as a number - Okay, one more related thing...
De : python (at) *nospam* mrabarnett.plus.com (MRAB)
Groupes : comp.lang.python
Date : 31. Aug 2024, 19:55:39
Autres entêtes
Message-ID : <mailman.25.1725130727.2917.python-list@python.org>
References : 1 2 3 4 5 6 7 8 9
User-Agent : Mozilla Thunderbird
On 2024-08-31 06:31, Gilmeh Serda via Python-list wrote:
On Fri, 30 Aug 2024 05:22:17 GMT, Gilmeh Serda wrote:
 
f"{int(number):>20,}"
 I can find "," (comma) and I can find "_" (underscore) but how about " "
(space)?
 Or any other character, for that matter?
 Any ideas?
 Of course I can do f"{123456:>20_}".replace("_", " "), just thought there
might be something else my search mojo fails on.
 
The format is described here:
https://docs.python.org/3/library/string.html#formatspec
A space is counted as a fill character.

Date Sujet#  Auteur
25 Aug 24 * Re: Formatting a str as a number10Stefan Ram
25 Aug 24 `* Re: Formatting a str as a number9Stefan Ram
27 Aug 24  +- Re: Formatting a str as a number1Stefan Ram
27 Aug 24  `* Re: Formatting a str as a number7Grant Edwards
31 Aug 24   +* Re: Formatting a str as a number - Okay, one more related thing...4Stefan Ram
31 Aug 24   i`* Re: Formatting a str as a number - Okay, one more related thing...3Stefan Ram
31 Aug 24   i +- Re: Formatting a str as a number - Okay, one more related thing...1Stefan Ram
1 Sep 24   i `- Re: Formatting a str as a number (Posting On Python-List Prohibited)1Lawrence D'Oliveiro
31 Aug 24   +- Re: Formatting a str as a number - Okay, one more related thing...1MRAB
2 Sep 24   `- Re: Formatting a str as a number - Okay, one more related thing...1dn

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal