假设我读取了从输入表单上传的文件(CSV),然后对其进行处理:
file = request.files['file']
filename = secure_filename(file.filename)
#using the file object to predict result
df=pd.read_csv(file)
results = model.predict(df.v2)
#saving the file requested from the form to a dir
file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename))
return results
执行此操作后,文件“ test.csv”将立即从目录中上传。删除(删除)file
对象的最干净方法是什么?