How can I generate file on the fly and delete it after download?

前端 未结 2 936
情深已故
情深已故 2021-01-18 08:17

here\'s my function that creates file on the fly(when the user clicks proper link)

@app.route(\'/survey//report\')
def survey_downloadreport         


        
2条回答
  •  执笔经年
    2021-01-18 08:33

    I've used os.unlink for a while with success:

    import os
    
    os.unlink(os.path.join('/path/files/csv/', '%s' % file))
    

    Hope it helps.

提交回复
热议问题