0
아래의 코드에서 제출 버튼을 누르면 양식에 머물러야합니다. 현재 제출을 누르면 텍스트가 사라집니다. 양식 항목 이름부터 https://www.udacity.com/course/viewer#!/c-cs253/l-48736183/e-48754026/m-48717294Python - 양식의 텍스트가 사라짐
import webapp2
form = """
<!DOCTYPE html>
<head>
<title>Unit 2 Rot 13</title>
</head>
<body>
<h2>Enter some text to ROT13:</h2>
<form method = "post">
<textarea name="text" value="%(word)s" style="height: 100px; width: 400px;"></textarea>
<br>
<input type="submit">
</form>
</body>
</html>
"""
class MainHandler(webapp2.RequestHandler):
def write_form(self, word=""):
self.response.out.write(form % {"word": word})
def get(self):
self.write_form()
def post(self):
string = self.request.get("word")
self.write_form(string)
app = webapp2.WSGIApplication([('/', MainHandler),
], debug=True)