Skip to Main Content
Python Rusz głową! Wydanie II
book

Python Rusz głową! Wydanie II

by Paul Barry
November 2017
Intermediate to advanced content levelIntermediate to advanced
578 pages
23h 17m
Polish
Helion
Content preview from Python Rusz głową! Wydanie II
276
Rozdział 6.
Użyj tego szablonu
Produkcja czytelnych danych wyjściowych
przy użyciu silnika Jinja2
Jako że szablon viewlog.html dziedziczy po szablonie base.html, musisz pamiętać, aby
zapewnić wartość dla argumentu
the_title
oraz dostarczyć listę nagłówków kolumn
(opisowych tytułów) za pomocą argumentu
the_row_titles
. Nie zapomnij też
przypisać listy
contents
do argumentu
the_data
.
Funkcja
view_the_log
wygląda w tej chwili tak, jak zostało to pokazane poniżej.
@app.route(‘/viewlog’)
def view_the_log() -> ‘str’:
contents = []
with open(‘vsearch.log’) as log:
for line in log:
contents.append([])
for item in line.split(‘|’):
contents[-1].append(escape(item)) ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Python. Receptury. Wydanie III

Python. Receptury. Wydanie III

David Beazley, Brian K. Jones
Python. Programuj szybko i wydajnie

Python. Programuj szybko i wydajnie

Micha Gorelick, Ian Ozsvald

Publisher Resources

ISBN: 9788328337343