Hi,

I have a cgi script in python that outputs a html table, but i also need to count the number of rows in that specific table. Any ideas on how i can proceed?

Thanks in advance,

ymf

Recommended Answers

All 2 Replies

Look for a delimiter between the rows and .count() them.

Jeff

Hi,

Thanks for the delimiter idea, i'll try that as well. I inserted a count function within the loop that prints the table rows. i.e everytime it prints a specific row the count value increases by one as follows:

count = 0
for word in alist:
                word = word.strip() 
        count += 1
        print "<td> ",word,"</td>"
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.