Bug in https://docs.python.org/3.10/library/string.html
One of the examples of string formatting doesn't work. This applies to prior versions of Python as well. The last set of the examples headed: 'Nesting arguments and more complex examples:' starts with the following code:
for align, text in zip('<^>', ['left', 'center', 'right']):... '{0:{fill}{align}16}'.format(text, fill=align, align=align)...
This omits print()The correct code would be:
for align, text in zip('<^>', ['left', 'center', 'right']):... print('{0:{fill}{align}16}'.format(text, fill=align, align=align))...
Best wishes Richard Hyde
Hi, The mailing list already know it. I repeat it for Richard Hyde in case you are not a member of the list. I filled a bug for you on https://bugs.python.org/issue46087?@ok_message=msg%20408624%20cr%C3%A9%C3%A9%0Aissue%2046087%20cr%C3%A9%C3%A9&@template=item#msg408624 and I submitted a correction on https://github.com/python/cpython/pull/30126 Thanks Arthur On 15.12.21 12:11, Richard Hyde via docs wrote:
One of the examples of string formatting doesn't work. This applies to prior versions of Python as well.
The last set of the examples headed: 'Nesting arguments and more complex examples:' starts with the following code:
foralign,textinzip('<^>',['left','center','right']):... '{0:{fill}{align}16}'.format(text,fill=align,align=align)...
This omits print() The correct code would be:
foralign,textinzip('<^>',['left','center','right']):... print('{0:{fill}{align}16}'.format(text,fill=align,align=align))...
Best wishes
Richard Hyde
_______________________________________________ docs mailing list -- docs@python.org To unsubscribe send an email to docs-leave@python.org https://mail.python.org/mailman3/lists/docs.python.org/ Member address: arthur@milchior.fr
participants (2)
-
Arthur Milchior
-
Richard Hyde