Answers for "add datetime to filename in python"

0

python add datetime to filename

from datetime import datetime

date = datetime.now().strftime("%Y_%m_%d-%I:%M:%S_%p")
print(f"filename_{date}")

'filename_2020_08_12-03:29:22_AM'
Posted by: Guest on December-03-2020

Python Answers by Framework

Browse Popular Code Answers by Language