title: Flask - Display results of code to the webpage
body: <p>I asked a similar question yesterday I think but I guess that I didn't really explain what was my problem. I have a program that retrieves some data from a request. Everything is fine if I run it from the Terminal, everything good and now I want to know how can I display those results to a webpage. It's just a plain thing, nothing fancy. A blank webpage with the text-results there. This is the script:</p>
  
  <pre><code>for key in r['playerstats']['stats']:
      if key['name'] == "total_kills":
          print("Total kills: " + str(key['value']))
  
      elif key['name'] == "total_deaths":
          print("Total deaths: " + str(key['value']))
  </code></pre>
  
  <p>The process is simple: there's a form, the user puts their name on it and then below the code does the requests and everything and the results are displayed.</p>
  
  <p>That's a part of the code that does the process, let's say I want to display the results of the code above. How can I do it on flask? Do I have to replace the <code>print-s</code> for variable names? Do I have to paste the code on the flask script? </p>
  
  <p>The output of that is (something like):</p>
  
  <pre><code>Total kills: (number)
  Total deaths: (number)
  </code></pre>
  
  <p>But I don't know how can I take that from just a terminal to the webpage; that's my concern and I hope someone can help me. If I need to elaborate more my question, please let me now :)</p>
  
  <p>P.S. I read part of the Flask and Jinja2 documentation but to be honest I didn't quite get parts of it and hopefully with an answer from here I'll be more on track.</p>