What meaning of this ""hello %s you are %s years old" % x"
fomcl at yahoo.com
Mon Jul 28 09:41:35 CEST 2014
> That's not tuple%tuple, but rather string%tuple. And string%tuple is
> the older method of formatting an output string from a template and a
> tuple of values. See
> https://docs.python.org/2/library/stdtypes.html#string-formatting for
> However, if you are just learning Python, you should probably use the
> *newer* formatting operations. See
> https://docs.python.org/3.3/library/string.html#formatspec for details
> of that.
Do you know what was the reason/consideration to switch to a new formatting operation? Ability to have custom formatters with an own __format__ method?
More information about the Python-list