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 35
| 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='GET'> <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='GET')#默认就是GET def gepinfo(): id = request.query.id email = request.query.email return (id,email)
run(port=8088,debug=True,reloader=True)
|