aktuelle SituationWie zu formatieren und die Anzeige in einer Liste in der Flasche der Vorlage eingestellt?
index_template.tpl
{{links}}
Ausgabeergebnis
[{'http://www.oreilly.com/careers/', 'http://www.oreilly.com/about/editorial_independence.html', 'https://cdn.oreillystatic.com/pdf/oreilly_high_performance_organizations_whitepaper.pdf', 'https://www.youtube.com/user/OreillyMedia', 'https://www.safaribooksonline.com/?utm_medium=content&utm_source=oreilly.com&utm_campaign=lgen&utm_content=20170601+nav'}, {'http://www.oreilly.com/careers/', 'http://www.oreilly.com/about/editorial_independence.html'}, {'http://www.oreilly.com/careers/', 'http://www.oreilly.com/about/editorial_independence.html', 'https://cdn.oreillystatic.com/pdf/oreilly_high_performance_organizations_whitepaper.pdf', 'https://www.youtube.com/user/OreillyMedia'}]
Ich habe die folgenden Code, aber wie kann ich den Hierarc anzeigen H ie leichter verständlich, indem man es mit "," trennt?
index_template.tpl
<html>
<ul>
%for item in links:
<li>{{item}}</li>
%end
</ul>
</html>
Ausgabeergebnis
・{'http://www.oreilly.com/careers/', 'http://www.oreilly.com/about/editorial_independence.html', 'https://cdn.oreillystatic.com/pdf/oreilly_high_performance_organizations_whitepaper.pdf', 'https://www.youtube.com/user/OreillyMedia', 'https://www.safaribooksonline.com/?utm_medium=content&utm_source=oreilly.com&utm_campaign=lgen&utm_content=20170601+nav'}
・{'http://www.oreilly.com/careers/', 'http://www.oreilly.com/about/editorial_independence.html'}
・{'http://www.oreilly.com/careers/', 'http://www.oreilly.com/about/editorial_independence.html', 'https://cdn.oreillystatic.com/pdf/oreilly_high_performance_organizations_whitepaper.pdf', 'https://www.youtube.com/user/OreillyMedia'}
Sind Sie sicher, dass dies ein 'dict' ist? Sieht aus wie ein 'Set' in einer' Liste'. In jedem Fall ermöglicht die in Bottle integrierte Template-Sprache das Iterieren über Sammlungen mit Python-artiger Syntax. –
innerhalb einer Liste ist kein Wörterbuch – re3