4 Replies - 1185 Views - Last Post: 28 July 2009 - 10:50 PM Rate Topic: -----

#1 dumbstruckk   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 18
  • Joined: 13-July 08

Looping display

Posted 28 July 2009 - 09:57 PM

Hey guys, is it possible to make your data from a loop display vertically instead of horizontally?
I need it to look something like this:
Posted Image

but right now, all I can get it to look like is this:
Posted Image

The code I have so far
<tbody>
<tr>
<th scope="row">
"""

for entry in data:
	print entry[0]

print "</th>"
print "<td>"

for entry in data:
	print entry[1]

print "</td>"
print "<td>"

for entry in data:
	print entry[2]
	
print "</td>"
print "</tr>"
print "</tbody>"



Is This A Good Question/Topic? 0
  • +

Replies To: Looping display

#2 BetaWar   User is offline

  • #include "soul.h"
  • member icon

Reputation: 1695
  • View blog
  • Posts: 8,592
  • Joined: 07-September 06

Re: Looping display

Posted 28 July 2009 - 10:20 PM

I am no perl programmer, so you may want to disregard this post depending on who else posts, but here is a shot. At the moment you are only creating 1 table row, and three columns which you are placing all the data into.

Try this:

<tbody>
"""
for entry in data:
	print "<tr><th scope=\"row\">"
	print entry[0]
	print "</th><td>"
	print entry[1]
	print "</td><td>"
	print entry[2]
	print "</td></tr>"
print "</tbody>"


Hopefully that helps.
Was This Post Helpful? 0
  • +
  • -

#3 dumbstruckk   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 18
  • Joined: 13-July 08

Re: Looping display

Posted 28 July 2009 - 10:36 PM

View PostBetaWar, on 28 Jul, 2009 - 09:20 PM, said:

I am no perl programmer, so you may want to disregard this post depending on who else posts, but here is a shot. At the moment you are only creating 1 table row, and three columns which you are placing all the data into.

Try this:

<tbody>
"""
for entry in data:
	print "<tr><th scope=\"row\">"
	print entry[0]
	print "</th><td>"
	print entry[1]
	print "</td><td>"
	print entry[2]
	print "</td></tr>"
print "</tbody>"


Hopefully that helps.


It helped. Thank you!! :)
Was This Post Helpful? 0
  • +
  • -

#4 BetaWar   User is offline

  • #include "soul.h"
  • member icon

Reputation: 1695
  • View blog
  • Posts: 8,592
  • Joined: 07-September 06

Re: Looping display

Posted 28 July 2009 - 10:37 PM

No problem, I figured it was similar to Python syntac (as they are combined in this forum) so I thought I would take a shot :)

Glad to have helped.
Was This Post Helpful? 0
  • +
  • -

#5 dumbstruckk   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 18
  • Joined: 13-July 08

Re: Looping display

Posted 28 July 2009 - 10:50 PM

edited post :P

This post has been edited by dumbstruckk: 29 July 2009 - 12:04 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1