According to the documentation concerning the date format codes:
The following is a list of all the format codes that the 1989 C standard requires, and these work on all platforms with a standard C implementation.
However, some ISO 8601 date values are included, but they're not available on all platforms when used with the strftime()
method.
If you're going to call an ambiguous or incomplete ISO 8601 parameter, you're going to get a ValueError
So, if you want to get the full set of format codes, you'd have to consult the strftime()
documentation, as supported values for the codes vary across platform, because Python calls the platform C library's strftime(3)
function.
For Linux see this page.
For Mac check this url.
As for the code, I'm not aware of any method that does what you want.
Source code for datetime.py
is here.