就只是调用格式化的函数不同看起来更简洁一些?
print(f"Tick! The time is: {datetime.now():%Y-%m-%d %H:%M:%S}")
print(f"Tick! The time is: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}")
官方文档上面讲了的,f-string 格式化时间和 strftime() 是一样的,date.__format__ Same as date.strftime()
https://docs.python.org/3/library/datetime.html#datetime.date.__format__