Deutsch   English   Français   Italiano  
<mailman.25.1725130727.2917.python-list@python.org>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!fu-berlin.de!uni-berlin.de!not-for-mail
From: MRAB <python@mrabarnett.plus.com>
Newsgroups: comp.lang.python
Subject: Re: Formatting a str as a number - Okay, one more related thing...
Date: Sat, 31 Aug 2024 19:55:39 +0100
Lines: 20
Message-ID: <mailman.25.1725130727.2917.python-list@python.org>
References: <oRHyO.142039$bV6e.134076@fx08.ams4>
 <asked-20240825164104@ram.dialup.fu-berlin.de>
 <combination-20240825164553@ram.dialup.fu-berlin.de>
 <vYqzO.8$fip4.7@fx09.ams4> <4Wtgt14jXFznWHr@mail.python.org>
 <mailman.12.1724794762.2917.python-list@python.org>
 <dGcAO.20275$Ic_6.799@fx01.ams4> <tUxAO.85679$fD72.80638@fx06.ams4>
 <9e13c5d9-fda3-4d7d-a87b-3dfd1c51f6ed@mrabarnett.plus.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de 2PQWTr/8zQoOLDnJX35wQQLoEAxBg4XHlRvEBIyohrRQ==
Cancel-Lock: sha1:DIAHKjWO9/S9D0Qph2exLihzqMY= sha256:swQFqqU6DlyqSX3ee71bHhs1yPnkADsxoBjKM68ierc=
Return-Path: <python@mrabarnett.plus.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
 reason="2048-bit key; unprotected key"
 header.d=plus.com header.i=@plus.com header.b=Z3XhzXWg;
 dkim-adsp=none (unprotected policy); dkim-atps=neutral
X-Spam-Status: OK 0.020
X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'aug': 0.07; 'fails': 0.09;
 'from:addr:python': 0.09; 'received:192.168.1.64': 0.09; '2024':
 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:name:mrab':
 0.16; 'matter?': 0.16; 'message-id:@mrabarnett.plus.com': 0.16;
 'received:plus.net': 0.16; 'wrote:': 0.16; 'to:addr:python-list':
 0.20; 'fri,': 0.22; 'space': 0.26; 'else': 0.27; 'header:User-
 Agent:1': 0.30; 'python-list': 0.32; 'received:192.168.1': 0.32;
 'but': 0.32; 'there': 0.33; 'fill': 0.34; 'header:In-Reply-To:1':
 0.34; 'received:192.168': 0.37; 'on.': 0.39; 'something': 0.40;
 'search': 0.61; 'format': 0.62; 'received:212': 0.62; 'skip:f 20':
 0.75; 'subject:one': 0.76; 'subject:more': 0.95
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=plus.com; s=042019;
 t=1725130540; bh=RvA+dZV4Lj6SygHbU3Kcjd3DPiHGeglSiOeyQdhAgts=;
 h=Date:Subject:To:References:From:In-Reply-To;
 b=Z3XhzXWgRSj09FPfcbhzJBfe/SjZRDYUKlMZQ2Sb7i3Rfm050/sykiCiBD1HlVoOJ
 3FlyqtupniVdWBL8baGK0syfcLxxjqc6YjisG5Lgg2dgu+6ifQwQO6dmtxoeEXJ9Pl
 iK8xL+MLkL70NL+qcHn+pNRUcStYvhuduwdvf/d4kk/GlwrK0x8fvl+Wg5Np2eo0Un
 gCRzQkVXQNnVxbgqfv+0aVlTmNq7mJMFlN2cAF/eBp1/oR9V9T9CTvk+jK65s4IYsF
 /F4bJEht7gsWKncY8ZfAOdm7BsCOatF+Gpg1pRwPwQ/T/mmTYlTx1+QmZ3QIQCpm5G
 2dkg6fXH743lw==
X-Clacks-Overhead: "GNU Terry Pratchett"
X-CM-Score: 0.00
X-CNFS-Analysis: v=2.4 cv=JP6YsNKb c=1 sm=1 tr=0 ts=66d3672c
 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17
 a=IkcTkHD0fZMA:10 a=8AHkEIZyAAAA:8 a=9BhTC2_CMXAuQcYKMiwA:9 a=QEXdDO2ut3YA:10
 a=wNw7CiXM-hcA:10 a=0lgtpPvCYYIA:10
X-AUTH: mrabarnett@:2500
User-Agent: Mozilla Thunderbird
Content-Language: en-GB
In-Reply-To: <tUxAO.85679$fD72.80638@fx06.ams4>
X-CMAE-Envelope: MS4xfJ4WcrCJbmtf7oxs59EhpOE4J9707zWrSiMZf+XwoGmYb2YToC1z+qHQhVixBH+/xvcvCexVuEwML0/NVLnxxldT7axLEetQ8SJ8eDqSME/apwWG4aSp
 xKMen99Bnk5copI042Oq+NOKY2CbRDmNTmQGwWMOqDcm5ItyDWWqKgU98PD7piQ4yb45tRm1s7WNVGG54ZftzOa7J19PgSDB0XQ=
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
 <python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
 <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
 <mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <9e13c5d9-fda3-4d7d-a87b-3dfd1c51f6ed@mrabarnett.plus.com>
X-Mailman-Original-References: <oRHyO.142039$bV6e.134076@fx08.ams4>
 <asked-20240825164104@ram.dialup.fu-berlin.de>
 <combination-20240825164553@ram.dialup.fu-berlin.de>
 <vYqzO.8$fip4.7@fx09.ams4> <4Wtgt14jXFznWHr@mail.python.org>
 <mailman.12.1724794762.2917.python-list@python.org>
 <dGcAO.20275$Ic_6.799@fx01.ams4> <tUxAO.85679$fD72.80638@fx06.ams4>
Bytes: 5005

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.