adding current date to a file name in a python script

markryde at markryde at
Sun Jan 29 10:06:35 CET 2006


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 =
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 "", line 13, in ?
    myFile = myFile.join(today)
TypeError: sequence expected, found

How should I do this ? 


More information about the Python-list mailing list