Re: Is there a better way? [combining f-string, thousands separator, right align]

2024-08-25 Thread Pierre Fortin via Python-list
On Sun, 25 Aug 2024 15:12:20 GMT Gilmeh Serda via Python-list wrote: >Subject explains it, or ask. > >This is a bloody mess: > s = "123456789" # arrives as str f"{f'{int(s):,}': >20}" >' 123,456,789' > f"{s:>20}" -- https://mail.python.org/mailman/listinfo/python-list

Re: Is there a better way? [combining f-string, thousands separator, right align]

2024-08-25 Thread Pierre Fortin via Python-list
On Sun, 25 Aug 2024 15:12:20 GMT Gilmeh Serda via Python-list wrote: >Subject explains it, or ask. > >This is a bloody mess: > s = "123456789" # arrives as str f"{f'{int(s):,}': >20}" >' 123,456,789' > Oops.. forgot comma f"{int(s):>20,}" -- https://mail.python.org/mailman/li

Re: How to Add ANSI Color to User Response

2024-04-13 Thread Pierre Fortin via Python-list
On Thu, 11 Apr 2024 05:00:32 +0200 Gisle Vanem via Python-list wrote: >Pierre Fortin wrote: > >> Over the years, I've tried different mechanisms for applying colors until >> I got my hands on f-stings; then I created a tiny module with all the >> colors (cR, cG, et

Re: How to Add ANSI Color to User Response

2024-04-10 Thread Pierre Fortin via Python-list
On Thu, 11 Apr 2024 04:50:49 +1000 WordWeaver Evangelist via Python-list wrote: >Hello List, > >I have a simple question. I use the following textPrompt in some of my Jython >modules: > '\nYour choice is? (A B C D E): ', maxChars=1, autoAccept=False, > forceUppercase=True) >Is there a way

Re: Newline (NuBe Question)

2023-11-15 Thread Pierre Fortin via Python-list
On Wed, 15 Nov 2023 16:51:09 - Grizzy Adams via Python-list wrote: I don't give solutions; just a nudge... you appear not to fully grok "list"; your list is ONE list with no delineation between students. You want a "list of lists"... >['Example High', 'Mary', 89.6, 'Pass', 'Example High', 'M

iterations destroy reversed() results

2023-09-03 Thread Pierre Fortin via Python-list
Hi, reversed() results are fine until iterated over, after which the results are no longer available. This was discovered after using something like this: rev = reversed( sorted( list ) ) sr = sum( 1 for _ in rev ) # rev is now destroyed So reversed() results can only be iterated once unlike so