The date class defines the __format__() magic method, which is called by str.format() to produce a “formatted” string representation of an object. To quote the documentation for date.__format__():
Same as
date.strftime(). This makes it possible to specify a format
string for adateobject in formatted string literals and when using
str.format(). For a complete list of formatting directives, see
strftime()andstrptime()Behavior.
Therefore, '{:%A}'.format(date.today()) is equivalent to date.today().strftime('%A').
solved How does formatting a Python date object with str.format() work?