Custom formatting for a class

suggest change

Note:

Everything below applies to the str.format method, as well as the format function. In the text below, the two are interchangeable.

For every value which is passed to the format function, Python looks for a __format__ method for that argument. Your own custom class can therefore have its own __format__ method to determine how the format function will display and format your class and its attributes.

object.__format__(self, format_spec)

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents