On Sun, Aug 24, 2008 at 8:26 PM, Ezra Taylor <[EMAIL PROTECTED]> wrote:
> Hello all: > Can I do the below with input() from fileinput? If > this is not possible, what can I do to create backup files with the > date timestamp as an extension. Thanks for you help all. > > > from time import strftime > > for line in fileinput.input(inplace=1,backup='.strftime("%Y-%b-%d.%S")' > do something. > -- > filename = "myfile" + strftime("%Y-%b-%d.%S") + ".txt" f = open(filename, "w") mystring = "This is a file or something" f.write(mystring) f.close() I assume strftime creates a string object so you can concatenate it.... but that should give you what you need (or at least point you in the right direction). -Wayne -- To be considered stupid and to be told so is more painful than being called gluttonous, mendacious, violent, lascivious, lazy, cowardly: every weakness, every vice, has found its defenders, its rhetoric, its ennoblement and exaltation, but stupidity hasn't. - Primo Levi
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor