title: Python/FLASK - html form return strings. How check if it containt number?
body: <p>I have very simple code - Im looking for better solution my case:
  I have:
   - 2 input text + submit button</p>
  
  <p>Input forms always returns text as string.
  Do you know better solution (and shorter) to <strong>pass only numeric values</strong> (and for non numeric - show "error") except gather all letters in list and check statement <em>if text from input is not in list with letters</em>?</p>
  
  <pre><code>from flask import Flask, render_template, request
  
  app = Flask(__name__)
  
  @app.route("/licz/", methods=['GET'])
  def search():
      licz1 = request.args.get('liczba1')
      licz2 = request.args.get('liczba2')
      notnumbers = ['q','w','e','r','t','y']
      if licz1 and licz2 != None:
  
          if licz1 not in notnumbers:
              sumaliczenia = int(licz1) + int(licz2)
              return render_template('liczenie.html', suma=sumaliczenia)
          else:
              sumaliczenia = "error"
              return render_template('liczenie.html', suma=sumaliczenia)
  
      else:
          return render_template('liczenie.html')
  
  app.run(debug=True)
  </code></pre>
  
  <p>Template code (from comment below):</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
    &lt;html lang="en"&gt;
      &lt;head&gt;
        &lt;meta charset="UTF-8"&gt;
        &lt;title&gt;Formularz&lt;/title&gt;
      &lt;/head&gt;
      &lt;body&gt; Result is {{ suma }}
        &lt;form action="/licz/" method="get"&gt;
          &lt;input type="text" name="liczba1"&gt;
          &lt;input type="text" name="liczba2"&gt; &lt;button type="submit"&gt;Send&lt;/button&gt; 
        &lt;/form&gt;
      &lt;/body&gt;
    &lt;/html&gt;
  </code></pre>