By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,548 Members | 1,496 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,548 IT Pros & Developers. It's quick & easy.

size of an array..

P: n/a
hi..

another basic question...

in the following:
#test python script
import libxml2dom
import urllib

print "hello"

turl =
"http://courses.tamu.edu/ViewSections.aspx?campus=CS&x=hvm4MX4PXIY9J8C2Dcxz 5
0ncXTJdT7v2&type=M"

f = urllib.urlopen(turl)
s = f.read()
f.close()
# s contains HTML not XML text
d = libxml2dom.parseString(s, html=1)
# get the community-related links
for label in
d.xpath("/html/body/table/tr/td[2]/table/tr[6]/td/table/child::tr/td[@class=
'sectionheading']/text()"):
print label.nodeValue

print "/n/n/n/"

l =
d.xpath("/html/body/table/tr/td[2]/table/tr[6]/td/table/child::tr/td[@class=
'sectionheading']/text()")

xx = =sizeof(l)
print "test\n"
print "l = ".xx." \n"
print l[1].nodeValue
================================================== =======

how do i determine the size of "l"

from the "for label in d.xpath", i assume that "d.xpath" is returning
multiple strings/objects/etc... and that label is assigned to the next
"element during the loop.

is there a way to determine the number of elements in "l", or the number of
iterations for the "for loop" prior to running it...

the tutorials i've seen as of yet haven't mentioned this..

thanks

-bruce

Jul 2 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
"bruce" <be*******@earthlink.netwrote:
from the "for label in d.xpath", i assume that "d.xpath" is returning
multiple strings/objects/etc... and that label is assigned to the next
"element during the loop.

is there a way to determine the number of elements in "l", or the number of
iterations for the "for loop" prior to running it...

the tutorials i've seen as of yet haven't mentioned this..
Have you tried len(object)?

-- Barry

--
http://barrkel.blogspot.com/
Jul 2 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.