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