How to printout data from a list in web2py

81 views Asked by At

In a code such as shown below, I have data that is dumped to a list as shown:

def foo():
    list1=[It’s possible Arianne could appear in future seasons, but as Kotaku notes,   the official character bio of Trystane describes him as the heir to Dorne, while Ariane’s love interest, Aerys Oakheart, has also not been cast. The exclusion comes as a surprise to fans, not just because Arianne is a major player in the fantasy novels’ numerous plot twists, but also because she was a strong, complex female character in a fictional universe that doesn’t have too many of those.]
    return list1

In view html:

{{extend 'layout.html'}}
<h1>{{=list1}}</h1>

How do I make it to print out each sentence as a bullet point?

1

There are 1 answers

0
BartoszGo On

Controller:

def foo(): list1=["It's possible Arianne could appear in future seasons, but as Kotaku notes, the official character bio of Trystane describes him as the heir to Dorne, while Ariane’s love interest, Aerys Oakheart, has also not been cast.", "The exclusion comes as a surprise to fans, not just because Arianne is a major player in the fantasy novels’ numerous plot twists, but also because she was a strong, complex female character in a fictional universe that doesn’t have too many of those."] return dict(list1=list1)

View:

{{extend 'layout.html'}}

<ul>

{{for row in list1:}}

<li>{{=row}} </li>

{{pass}}

</ul>

The view iterates through the list and creates one "li" tag per each item passed by the controller.