[mod_python] using nested loop to display results in psp

Gregory (Grisha) Trubetskoy grisha at modpython.org
Fri Mar 19 11:48:45 EST 2004


<html>
<%
names1 = (('Steve','Barker','34'),('John','Smith','27'))
for n in names1:
    for w in n:
        # begin
%>
<%=w%>
<%
    # end
%>
    <br>
<%
# end
%>
</html>

*** OR ***

<html>

<%
names1 = (('Steve','Barker','34'),('John','Smith','27'))
for n in names1:
    for w in n:
        req.write(w + '\n')
    req.write('<br>\n')
# end
%>

</html>

On Fri, 19 Mar 2004 anthony.barker at bmo.com wrote:

> psp script
>
> =========================================
> <html>
> <%
> names1 = (('Steve','Barker','34'),('John','Smith','27'))
> for n in names1:
>         for w in n:
> %>
> <%=w%>
> <br>
> <%
> %>
> <%
> %>
> </html>
> ===========================================
>
> results:
>
> Steve
> Barker
> 34
> John
> Smith
> 27
>
> What I would like to do is format it so that the <br> comes at the end of
> the first for loop.
>
> Steve Barker 34
> John Smith 27
>
> Any ideas?
> Once that is working I will reformat it into a table. with <td> and <tr>


More information about the Mod_python mailing list