test
parent
5290736217
commit
1590980cb9
@ -1,31 +0,0 @@
|
|||||||
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