Custom Formatters

Learn about custom formatters and get hands-on experience using the coding example.

We'll cover the following

Overview

While these standard formatters apply to most built-in objects, it is also possible for other objects to define nonstandard specifiers. For example, if we pass a datetime object into format, we can use the specifiers used in the datetime.strftime() function, as follows:

Get hands-on with 1200+ tech skills courses.