From 059677a9ccc5cd3cacee322344a763b0c7f757b2 Mon Sep 17 00:00:00 2001 From: Prometheus3375 <35541026+Prometheus3375@users.noreply.github.com> Date: Sat, 5 Apr 2025 13:19:51 +0000 Subject: [PATCH 1/2] Add more examples of grouping --- Doc/library/string.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Doc/library/string.rst b/Doc/library/string.rst index f2f3ab9eefdd50..ffb583ecf452d1 100644 --- a/Doc/library/string.rst +++ b/Doc/library/string.rst @@ -735,12 +735,20 @@ Using the comma or the underscore as a digit group separator:: '100_1001_1001_0110_0000_0010_1101_0010' >>> '{:_x}'.format(1234567890) '4996_02d2' + >>> '{:,}'.format(123456789.123456789) + '123,456,789.12345679' + >>> '{:.,}'.format(123456789.123456789) + '123456789.123,456,79' + >>> '{:,.,}'.format(123456789.123456789) + '123,456,789.123,456,79' >>> '{:_}'.format(123456789.123456789) '123_456_789.12345679' >>> '{:._}'.format(123456789.123456789) '123456789.123_456_79' >>> '{:_._}'.format(123456789.123456789) '123_456_789.123_456_79' + >>> '{:,._}'.format(123456789.123456789) + '123,456,789.123_456_79' Expressing a percentage:: From 2580c4b577709c614a50bf717f7940d78db4f29d Mon Sep 17 00:00:00 2001 From: Prometheus3375 <35541026+Prometheus3375@users.noreply.github.com> Date: Sun, 6 Apr 2025 18:02:58 +0000 Subject: [PATCH 2/2] Shorten the number of examples --- Doc/library/string.rst | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/Doc/library/string.rst b/Doc/library/string.rst index ffb583ecf452d1..5e2f35497cbe86 100644 --- a/Doc/library/string.rst +++ b/Doc/library/string.rst @@ -735,18 +735,10 @@ Using the comma or the underscore as a digit group separator:: '100_1001_1001_0110_0000_0010_1101_0010' >>> '{:_x}'.format(1234567890) '4996_02d2' - >>> '{:,}'.format(123456789.123456789) - '123,456,789.12345679' - >>> '{:.,}'.format(123456789.123456789) - '123456789.123,456,79' - >>> '{:,.,}'.format(123456789.123456789) - '123,456,789.123,456,79' >>> '{:_}'.format(123456789.123456789) '123_456_789.12345679' - >>> '{:._}'.format(123456789.123456789) - '123456789.123_456_79' - >>> '{:_._}'.format(123456789.123456789) - '123_456_789.123_456_79' + >>> '{:.,}'.format(123456789.123456789) + '123456789.123,456,79' >>> '{:,._}'.format(123456789.123456789) '123,456,789.123_456_79'