python - How to use a variable in filename -
i trying use current date & time file name spreadsheet file keep on getting error "no such file or directory exists." below code tried use:
wb = workbook() dest_filename = time.strftime("%d/%m/%y_%h:%m.xlsx") wb.save(filename = dest_filename)
look @ file name:
time.strftime("%d/%m/%y_%h:%m.xlsx")
when statement executed returns result this:
'10/06/2015_11:44.xlsx'
do have directory structure looks this:
/pathtoscript /10 /06 2015_11:44.xlsx
those /
s in file name indicating directories. if wish have d-m-y pattern, suggest using other /
separator:
time.strftime("%d-%m-%y_%h:%m.xlsx")
Comments
Post a Comment