1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
| from bottle import route,run,request htmlst = """ <!DOCTYPE html> <html> <head> <meta charset='utf-8'> <title><h2>你好</h2></title> </head> <body> <form action="/info" method='POST'> <label>ID</label> <input type = "text" name="id" /> <label>e-mail</label> <input type = "text" name="email" /> <input type="submit"/> </form > </body> </html> """
@route('/') def index(): return htmlst
@route('/info',method='POST') def f(): id = request.forms.get('id') email = request.forms.get('email') return (id,email)
run(port=8088,debug=True,reloader=True)
|