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"])
def getText():
if request.method == "POST":
txt = request.form["txt"]
size_txt = txt.count()
txt = request.form["txt"].strip()
if txt:
# print(txt)
print(size-txt)
words = txt.split()
word_count = len(words)
print(txt)
print(word_count)
else:
print('empty text')