我无法打印结果。如果我使用,这在烧瓶上工作正常,result= request.form然后print(result). 这会在烧瓶上打印字典。但使用瓶子不起作用。当我使用type(result)它时说<class 'bottle.FormsDict'>
x.py 文件:
from bottle import request, template,route,run,post
@route('/')
def index():
return template('val.html')
@post('/result')
def result():
result=request.forms
print(result) #Unable to print
if __name__ == '__main__':
run(host='localhost',port=8080,debug='True',reloader='True')
Run Code Online (Sandbox Code Playgroud)
val.html 文件:
<!DOCTYPE html>
<html>
<body>
<form action="http://localhost:8080/result" method = "POST">
Select a time:
<input type="time" name="usr_time">
<br> <br>
<input type="checkbox" name="A" value="A is on" >A </input>
<br>
<input type="checkbox" name="B" value="B is on" >B </input>
<br>
<input type="checkbox" name="C" value="C is on" >C …Run Code Online (Sandbox Code Playgroud)