ActivePython and Amara

alex23 wuwei23 at gmail.com
Fri Dec 16 01:34:05 EST 2005


> i know much about python and i dont excactly need help
> learning the basics of python because i know it, once again, its the
> module i need help with...

No, you _really_ don't.

If you were python-capable, you would have been able to extrapolate
from the example I gave above to answer your own question:

> Can't i get just the first three[ items?]

channel.findall('item') returns a _list_...so
channel.findall('item')[:3] would give you the first 3 elements of that
list....like it does with _every_ list.

This isn't an issue with feedparser, this is a _fundamental behaviour
of python sequences_. How many elements you take from a list and how
you store & handle those elements doesn't have _anything_ to do with
feedparser in this instance.

This is all covered in section 8.2 ("Accessing lists") in the "Think
Like a Computer Scientist" tutorial (@
http://www.ibiblio.org/obp/thinkCSpy/)  that you finished "long
ago"...I'm surprised you didn't come across it.

-alex23




More information about the Python-list mailing list