Currently, in datetime.strftime, the only sub-second formatting code available is %f, which produces a fixed-width string of microsecond digits, padded from the left with zeros, like "004312".
While Python's datetime code for %f doesn't handle fractions, the fixed-length, zero-padded aspect makes it usable in producing the "fraction of the second" part of a datetime string. For example "...%H:%M:%S.%f" results in a string like ...22:11:55.012345.
There is no way to for datetime.strftime to produce a string with any other sub-second precision apart from 6 decimal places.
You cannot use datetime.strftime alone to obtain milliseconds, like 22:11:55.012, or any other fraction length between 1 and 5.