This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author p-ganssle
Recipients Alexander Bolshakov, SilentGhost, belopolsky, p-ganssle, xtreak
Date 2020-03-26.21:11:20
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
> isoformat function does not conform to the ISO 8601 and drops microseconds part if its value is 000000.

I'm not sure why you think that this does not conform to ISO 8601 - ISO 8601 is a sprawling beast of a spec and allows some crazy formats. Some examples of perfectly valid ISO 8601 strings:


There are *hundreds* of valid formats encompassed by ISO 8601.

Anyway, that's an aside. The behavior of .isoformat() is pretty clearly documented. These are the first three line of the documentation:

    Return a string representing the date and time in ISO 8601 format:

      - YYYY-MM-DDTHH:MM:SS.ffffff, if microsecond is not 0
      - YYYY-MM-DDTHH:MM:SS, if microsecond is 0

I believe Karthikeyan has adequately explained how to get the behavior you want, so I am going to go ahead and close this as working as intended.
Date User Action Args
2020-03-26 21:11:20p-gansslesetrecipients: + p-ganssle, belopolsky, SilentGhost, xtreak, Alexander Bolshakov
2020-03-26 21:11:20p-gansslesetmessageid: <>
2020-03-26 21:11:20p-gansslelinkissue40076 messages
2020-03-26 21:11:20p-gansslecreate