[issue1982] Feature: extend strftime to accept milliseconds
New submission from Andreas Balogh: Currently serializing datetime objects into isoformat string is well possible. The reverse process - parsing an isoformat string into a datetime object - doesn't work due to the missing %-tag for the strftime format string. Proposal: Add new tag to strftime like format strings allowing to print and parse milliseconds. -- components: Extension Modules messages: 61924 nosy: asbalogh severity: normal status: open title: Feature: extend strftime to accept milliseconds versions: Python 2.5 __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1982> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1982] Feature: extend strftime to accept milliseconds
Andreas Balogh <[EMAIL PROTECTED]> added the comment: Yes, microsecond support is fine. Elaborating on my initial comment. The following should assert: a_datetime = datetime.now() a_datetime.replace(microsecond = 1) iso_str = adatetime.isoformat() b_datetime = datetime.strptime(iso_str, "%Y%m%dT%H%M%S.%f") assert(a_datetime = b_datetime) The datetime shall be an invariant. Fixed from my point of view, Andreas ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1982> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1982] Feature: extend strftime to accept milliseconds
Andreas Balogh <[EMAIL PROTECTED]> added the comment: Some typos corrected. Sorry for any inconvenience. a_datetime = datetime.now() a_datetime.replace(microsecond = 1) iso_str = a_datetime.isoformat() b_datetime = datetime.strptime(iso_str, "%Y-%m-%dT%H:%M:%S.%f") assert(a_datetime = b_datetime) ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1982> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1982] Feature: extend strftime to accept milliseconds
Andreas Balogh added the comment: - a_datetime.replace(microsecond = 1) + a_datetime = a_datetime.replace(microsecond = 1) Thanks for spotting the bug. -- ___ Python tracker <http://bugs.python.org/issue1982> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7198] csv.writer
Andreas Balogh added the comment: I encountered the same problem. It is unclear that using binary mode for the file is solving the problem. I suggest to add a hint to the documentation. -- nosy: +baloan ___ Python tracker <http://bugs.python.org/issue7198> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com