title: Is there a way to create an HTML table from a list using bottle
body: <p>I'm using os.listdir to get a list of subdirectories and want to display them as a table on a webpage. I'm using bottle for the web framework. I have seen in the bottle documentation that it can be done by creating an sqlite database from the list and loading it in from there but ideally I'm looking for a way to avoid that intermediate step. I haven't been able to find any documentation without the sqlite step and was wondering if it was possible?</p>
  <p>Current code below displays the info I want on the webpage but as a single line of text.</p>
  <p>Current Code: <br />
  Bottle App</p>
  <pre><code>from bottle import Bottle, template, route, run, static_file
  import os
  import sys
  
  app = Bottle()
  
  dirname = os.path.dirname(sys.argv[0])
  
  @app.route('/static/&lt;filename:re:.*\.css&gt;')
  def send_css(filename):
      return static_file(filename, root=dirname+'/static/')
  
  
  @app.route('/')
  def index():
      dir_loc = &quot;/Users/me/Documents&quot;
      dir_data = list(os.listdir(dir_loc))
  
      return template('index', data = dir_data)
  
  
  run(app, host='localhost', port=8080, debug=True)
  </code></pre>
  <p>index.tpl</p>
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;meta charset=&quot;utf-8&quot;&gt;
      &lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;static/styling.css&quot;&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;div&gt;
          &lt;p&gt;Template for bottle showing {{data}}&lt;/p&gt;
      &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>