[Tutor] Populating a list

Alexander rhettnaxel at gmail.com
Mon Oct 22 04:35:02 CEST 2012


On Sun, Oct 21, 2012 at 9:44 PM, Saad Javed <sbjaved at gmail.com> 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.

What is the rssPage1? Where is that part?
And for readability I'd strong suggest using something other than a
lowercase L. l and I look the same in some fonts.


7D9C597B


More information about the Tutor mailing list