You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
735 B
Python

2 years ago
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