【发布时间】:2021-06-12 22:39:02
【问题描述】:
我需要从文件夹中删除 wav 文件。我可以列出文件,但我不知道如何删除它们。如果文件夹超过 5 分钟并且它是一个 wav 文件,则需要将其删除。我需要在烧瓶里做。
我的烧瓶代码
from flask import Flask, render_template, request
import inference
import os
app = Flask(__name__)
app.static_folder = 'static'
@app.route("/")
def home():
return render_template("index.html")
@app.route("/sentez", methods = ["POST"])
def sentez():
if request.method == "POST":
list_of_files = os.listdir('static')
print(list_of_files)
metin = request.form["metin"]
created_audio, file_path = inference.create_model(metin)
return render_template("index.html", my_audio = created_audio, audio_path = file_path)
return render_template("index.html")
if __name__ == "__main__":
app.run();
【问题讨论】:
标签: python file flask operating-system