On 22 Jul 2019 23:12, Skip Montanaro <[email protected]> wrote:
Assuming you're using Python 3, why not use an f-string?
>>> dt = datetime.datetime.now()
>>> dt.strftime("%Y-%m-%d %H:%M")
'2019-07-22 16:10'
>>> f"{dt:%Y-%m-%d %H:%M}"
'2019-07-22 16:10'
===》》 Or if you're running < Python 3.6 (no f strings): format(datetime.now(),
"%Y-%m-%d %H:%M")
--
https://mail.python.org/mailman/listinfo/python-list
