count word

This commit is contained in:
Nathan-rek
2024-11-18 16:09:47 +01:00
parent bed6033426
commit 91d538b30d

View File

@@ -70,11 +70,13 @@ def getGcode():
@app.route("/text", methods=["POST", "GET"]) @app.route("/text", methods=["POST", "GET"])
def getText(): def getText():
if request.method == "POST": if request.method == "POST":
txt = request.form["txt"] txt = request.form["txt"].strip()
size_txt = txt.count()
if txt: if txt:
# print(txt) words = txt.split()
print(size-txt) word_count = len(words)
print(txt)
print(word_count)
else: else:
print('empty text') print('empty text')