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

Popular posts from this blog

javascript - oscilloscope of speaker input stops rendering after a few seconds -

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -