Sujet : Re: Flubbed it in the second interation through the string: range error... HOW?
De : cs (at) *nospam* cskk.id.au (Cameron Simpson)
Groupes : comp.lang.pythonDate : 29. May 2024, 07:52:47
Autres entêtes
Message-ID : <mailman.55.1716962486.2909.python-list@python.org>
References : 1 2
User-Agent : Mutt/2.2.7 (2022-08-07)
On 29May2024 01:14, Thomas Passin <
list1@tompassin.net> wrote:
Also, it's 2024 ... time to start using f-strings (because they are more readable than str.format())
By which Thomas means stuff like this:
print(f'if block {name[index]} and index {index}')
Notice the leading "f'". Personally I wouldn't even go that far, just:
print('if block', name[index], 'and index', index)
But there are plenty of places where f-strings are very useful.