test py file
parent
9b369ac043
commit
c25a04b520
@ -0,0 +1,31 @@
|
||||
from flask import Flask, request
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
html_template = """
|
||||
<h1>transformations</h1>
|
||||
<form action="/" method="post">
|
||||
<input type="text" name="search">
|
||||
<br><br>
|
||||
<input type="submit" value="transform">
|
||||
</form>
|
||||
"""
|
||||
|
||||
@app.route("/", methods=["POST","GET"])
|
||||
def transformations():
|
||||
if request.method == "POST":
|
||||
|
||||
search = request.form["search"]
|
||||
|
||||
result_list = []
|
||||
for character in search:
|
||||
unicode_point = format(ord(character))
|
||||
result_list.append(character + " " + unicode_point)
|
||||
|
||||
result_string = "<br>\n".join(result_list)
|
||||
|
||||
return html_template + f"<pre>{ result_string }</pre>"
|
||||
|
||||
if request.method == "GET":
|
||||
|
||||
return html_template
|
Loading…
Reference in New Issue