Paul Ganssle <p.gans...@gmail.com> added the comment:

> 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:

--03-26
2020-W13-4T03
2020-03-26T03.5
2020-03-26T03,5
2020-03-26T03:30:40.334


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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue40076>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to