[Tutor] Populating a list
sbjaved at gmail.com
Mon Oct 22 11:31:23 CEST 2012
l.extend does work. Thanks!
On Monday, October 22, 2012, Saad Javed wrote:
> My program downloads multiple entry values from the net. I'm trying to
> combine them in a list in a particular sequence.
> l = 
> feed1 = urllib2.urlopen(rssPage1)
> tree1 = etree.parse(feed1)
> x = tree1.xpath("/rss/channel/item/title/text()")
> y = tree1.xpath("/rss/channel/item/pubDate/text()")
> z = tree1.xpath("/rss/channel/item/link/text()")
> for e, f, g in zip(x, y, z):
> l.append([e, f, g])
> print l
> The problem I'm facing is that the values don't combine into a single list
> ("l"). It keeps printing multiple lists with three values e, f, g as the
> xml tree is parsed.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor