已經(jīng)實(shí)現(xiàn)的:用flask寫一個(gè)網(wǎng)站,在表單里輸入數(shù)據(jù),點(diǎn)擊提交,即可下載一個(gè)生成的word。(用到flask-wtf和send_file)但是現(xiàn)在想的是點(diǎn)擊一次提交后,生成兩個(gè)不同的word供下載,求教思路?附上部分代碼(提交表單,下載生成的第一個(gè)word):def index():
name = None
form = NameForm() if form.validate_on_submit():
document = Document()
f = io.BytesIO()
document.save(f)
length = f.tell()
f.seek(0) filename = quote(name+'.doc')
rv = send_file(f, as_attachment=True,attachment_filename=filename)
rv.headers['Content-Disposition'] += "; filename*=utf-8''{}".format(filename) return rv
添加回答
舉報(bào)
0/150
提交
取消