adding current date to a file name in a python script
markryde at gmail.com
markryde at gmail.com
Sun Jan 29 04:06:35 EST 2006
Hello,
I am trying to add the current date to a file name in python script
like thus:
import os
import sys
import rpm
import time
import datetime
today = datetime.date.today()
print "The date is", today
myFile = '/work/output1'
myFile = myFile.join(today)
myFile = myFile.join(".txt")
print "myFile is",myFile
running the scripts indeed prints the correct date ,
but afterwards there is the following error:
The date is 2006-01-29
Traceback (most recent call last):
File "addDate.py", line 13, in ?
myFile = myFile.join(today)
TypeError: sequence expected, datetime.date found
How should I do this ?
Regards,
MR
More information about the Python-list
mailing list