Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>use pythons string manipulation: <a href="http://docs.python.org/2/library/stdtypes.html#string-formatting" rel="nofollow noreferrer">http://docs.python.org/2/library/stdtypes.html#string-formatting</a></p> <p>generally the % operator is used to put a variable into a string, %i for integers, %s for strings and %f for floats, NB: there is also another formatting type (.format) which is also described in the above link, that allows you to pass in a dict or list slightly more elegant than what I show below, this may be what you should go for in the long run as the % operator gets confusing if you have 100 variables you want to put into a string, though the use of dicts (my last example) kinda negates this. </p> <pre><code>code_str = "super duper heading" html = "&lt;h1&gt;%s&lt;/h1&gt;" % code_str # &lt;h1&gt;super duper heading&lt;/h1&gt; code_nr = 42 html = "&lt;h1&gt;%i&lt;/h1&gt;" % code_nr # &lt;h1&gt;42&lt;/h1&gt; html = "&lt;h1&gt;%s %i&lt;/h1&gt;" % (code_str, code_nr) # &lt;h1&gt;super duper heading 42&lt;/h1&gt; html = "%(my_str)s %(my_nr)d" % {"my_str": code_str, "my_nr": code_nr} # &lt;h1&gt;super duper heading 42&lt;/h1&gt; </code></pre> <p>this is very basic and only work with primitive types, if you want to be able to store dicts, lists and possible objects I suggest you use cobvert them to jsons <a href="http://docs.python.org/2/library/json.html" rel="nofollow noreferrer">http://docs.python.org/2/library/json.html</a> and <a href="https://stackoverflow.com/questions/4759634/python-json-tutorial">https://stackoverflow.com/questions/4759634/python-json-tutorial</a> are good sources of inspiration</p> <p>Hope this helps</p>
    singulars
    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.
    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