I would like to be able to add the day, month and year to the end of the filename. I plan on running a version of this script every day so I would like it to create a new file each day. I would like the file to look like "beta6.8.2007.csv" Any idea on how to do this?

import csv
import datetime
now = datetime.datetime.now()

writer = csv.writer(open(("beta.csv"), "ab"))
writer = csv.writer(open(("beta_%i.%i.%i.csv" % (now.day, now.month, now.year)), "ab")

Thank you for the quick response

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.