From 91d538b30de7eb3efcb31a8f0d2f06d3d91408bd Mon Sep 17 00:00:00 2001 From: Nathan-rek <130574828+Nathan-rek@users.noreply.github.com> Date: Mon, 18 Nov 2024 16:09:47 +0100 Subject: [PATCH] count word --- plotter-app/app.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/plotter-app/app.py b/plotter-app/app.py index 61312df..cc70b0a 100644 --- a/plotter-app/app.py +++ b/plotter-app/app.py @@ -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')