count word
This commit is contained in:
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user