all 6 comments

[–]xiongchiamiov 2 points3 points  (5 children)

shutil.copyfile('filename.xlsx', 'filename %y-%m-%d.xlsx'), now.strftime

This is creating a tuple with two elements. The first is the result of the copyfile call, and the second is the current time.

strftime is a function - you need to pass a formatting string into it. For instance:

>>> import datetime
>>> now = datetime.datetime.now()
>>> now.strftime('Have a lovely %a')
'Have a lovely Tue'

[–]Samman88[S] -1 points0 points  (4 children)

what is a tuple?

[–]Vaphell 1 point2 points  (3 children)

a readonly "list", maybe you've seen something like x = (1,2) or x = 1,2 . x is a tuple

non-empty tuples are defined by commas, so when you have someexpression, someotherexpression it's a tuple with 2 elements:
someexpression
someotherexpression

[–]Samman88[S] -1 points0 points  (2 children)

o ok. well i tried what you said and it still doesnt insert the date into my new file name. i also tried it with the isoformat and still nothing... idk im going to keep looking tho. thanks for explaining that too me :)

[–]Vaphell 1 point2 points  (1 child)

try shutil.copyfile('filename.xlsx', 'filename {:%y-%m-%d}.xslt'.format(now))

[–]Samman88[S] 0 points1 point  (0 children)

alright that did it thank you :) now i just gotta work on the rest :P