![]() ![]() Priority queue and heap queue data structure Python Object Serialization - yaml and json Python Object Serialization - pickle and json Sets (union/intersection) and itertools - Jaccard coefficient and shingling to check plagiarismĬlasses and Instances (_init_, _call_, etc.)īits, bytes, bitstring, and constBitStream Strings - Escape Sequence, Raw String, and Slicingįormatting Strings - expressions and method calls Object Types - Numbers, Strings, and None Running Python Programs (os, sys, import) This tells the template to insert the actual value of the variable right in place. ![]() If we need to access a variable within a non-Python code line inside the template, we need to put it into double curly braces. The first for statement accesses the tuples within the list, the second one the items within the tuple, which are put each into a cell of the table. The rows is a variable which holds the result of the database query, so it is a list of tuples. The other lines are plain HTML.Īs we can see, we use Python's for statement two times, in order to iterate over rows. Please note that, of course, only valid Python statements are allowed, otherwise the template will raise an exception. The line starting with % is interpreted as Python code. So, we need to write the wish_table.tpl template, which should like this: If we run the server at this stage and calls we get the following error: Note that templates always return a list of strings, thus there is no need to convert anything. In addition to calling the template, we assign result, which we received from the database query, to the variable rows, which is later on used within the template.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |