How to create filename with current date in Python

1 Answer

0 votes
from datetime import date

filename = "backup-" + str(date.today()) + ".txt"

print(filename)


'''
run:
 
backup-2018-11-15.txt

'''

 



answered Nov 15, 2018 by avibootz

Related questions

2 answers 446 views
3 answers 520 views
4 answers 640 views
1 answer 367 views
1 answer 268 views
1 answer 266 views
...