import time
print(time.strftime('%Y-%m-%d %H:%M:%S', time.localtime()))
print(time.strftime("%m_%d", time.localtime()))
结果:
2021-08-12 11:37:41
08-12
import time
print(time.strftime('%Y-%m-%d %H:%M:%S', time.localtime()))
print(time.strftime("%m_%d", time.localtime()))
结果:
2021-08-12 11:37:41
08-12