Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I would suggest using one of the many template languages available for python, for example the one <a href="https://docs.djangoproject.com/en/dev/topics/templates/" rel="noreferrer">built into Django</a> (you don't have to use the rest of Django to use its templating engine) - a google query should give you plenty of other alternative template implementations.</p> <p>I find that learning a template library helps in so many ways - whenever you need to generate an e-mail, HTML page, text file or similar, you just write a template, load it with your template library, then let the template code create the finished product. </p> <p>Here's some simple code to get you started:</p> <pre><code>#!/usr/bin/env python from django.template import Template, Context from django.conf import settings settings.configure() # We have to do this to use django templates standalone - see # http://stackoverflow.com/questions/98135/how-do-i-use-django-templates-without-the-rest-of-django # Our template. Could just as easily be stored in a separate file template = """ &lt;html&gt; &lt;head&gt; &lt;title&gt;Template {{ title }}&lt;/title&gt; &lt;/head&gt; &lt;body&gt; Body with {{ mystring }}. &lt;/body&gt; &lt;/html&gt; """ t = Template(template) c = Context({"title": "title from code", "mystring":"string from code"}) print t.render(c) </code></pre> <p>It's even simpler if you have templates on disk - check out the <a href="https://docs.djangoproject.com/en/dev/ref/templates/api/#the-render-to-string-shortcut" rel="noreferrer">render_to_string</a> function that can load templates from disk from a predefined list of search paths, fill with data from a dictory and render to a string - all in one function call.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload