Last active
November 22, 2017 16:12
-
-
Save hamukazu/82473b6214612821a8c2bb09d19fbecc to your computer and use it in GitHub Desktop.
Very simple example of bottle and form input
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bottle | |
app = bottle.Bottle() | |
s = """<p>名前は?</p> | |
<p> | |
<form method="GET" action="/get""> | |
<input type="text" name="a" /> | |
<input type="submit" /> | |
</form> | |
</p>""" | |
t = """ | |
<h1>{}さんこんばんは</h1> | |
""" | |
@app.route("/") | |
def root(): | |
return s | |
@app.route("/get") | |
def get(): | |
a = bottle.request.query.a | |
return t.format(a) | |
app.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment