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'
Skip -- https://mail.python.org/mailman/listinfo/python-list
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'
Skip -- https://mail.python.org/mailman/listinfo/python-list