how to send html object from python to web page Tornado
<p>Inside my python code I have a html code for table </p>

<pre><code>import os.path
import tornado.httpserver
import tornado.ioloop
import tornado.options
import tornado.web
from tornado.options import define, options
define("port", default=8000, help="run on the given port", type=int)
class IndexHandler(tornado.web.RequestHandler):
    def get(self):
        tables = "&lt;table&gt;  &lt;tr&gt;    &lt;th&gt;Company&lt;/th&gt;            &lt;th&gt;Contact&lt;/th&gt;    &lt;th&gt;Country&lt;/th&gt;  &lt;/tr&gt;  &lt;tr&gt;    \
    &lt;td&gt;Alfreds Futterkiste&lt;/td&gt;     &lt;td&gt;Maria Anders&lt;/td&gt;    &lt;td&gt;Germany&lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;    \
    &lt;td&gt;Centro comercial Moctezuma&lt;/td&gt;    &lt;td&gt;Francisco Chang&lt;/td&gt;     &lt;td&gt;Mexico&lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;    \
    &lt;td&gt;Ernst Handel&lt;/td&gt;    &lt;td&gt;Roland Mendel&lt;/td&gt;    &lt;td&gt;Austria&lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;  &lt;td&gt;Island Trading&lt;/td&gt;    \
    &lt;td&gt;Helen Bennett&lt;/td&gt;    &lt;td&gt;UK&lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;    &lt;td&gt;Laughing Bacchus Winecellars&lt;/td&gt; \
    &lt;td&gt;Yoshi Tannamuri&lt;/td&gt;    &lt;td&gt;Canada&lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;    &lt;td&gt;Magazzini Alimentari Riuniti&lt;/td&gt;    \
    &lt;td&gt;Giovanni Rovelli&lt;/td&gt; &lt;td&gt;Italy&lt;/td&gt;  &lt;/tr&gt; &lt;/table&gt;"


        self.render('index.html',tableinfo = tables)
if __name__ == '__main__':
    tornado.options.parse_command_line()
    app = tornado.web.Application(
        handlers=[(r'/', IndexHandler)],
        template_path=os.path.join(os.path.dirname(__file__), "templates"))
    http_server = tornado.httpserver.HTTPServer(app)
    http_server.listen(options.port)
    tornado.ioloop.IOLoop.instance().start()
</code></pre>

<p>I plan to print this table in the index.html file </p>

<pre><code>&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;&lt;title&gt;Help For table print&lt;/title&gt;&lt;/head&gt;
&lt;body&gt;
&lt;p&gt; {{tableinfo}}  &lt;/p&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>unfortunately it is only prints the string into the html code and does not use the code to create the table.
Could you please help me to show the table by exchanging variables.
Many thanks</p>

<p>Tornado template output is escaped by default. To include raw html, use the <code>raw</code> template directive (and be careful of XSS!): <code>{% raw tableinfo %}</code></p>

python html tornado