[Tutor] Data structure question / PyGoogle
Brian Edward
perronbe at gmail.com
Sat Sep 16 16:44:39 CEST 2006
Hello all,
I am new to Python (and programming in general) and am trying to get
PyGoogle figured out for some specific research interests. Basically, I
have done a simple search using PyGoogle and have some sitting in memory. I
have an object data.results, which is apparently a list:
>>> type(data.results)
<type 'list'>
In this list, I have ten URL saved, which I can access by using the brackets
and noting the specific elements. For example:
>>> data.results[0].URL
'http://www.psychguides.com/gl-treatment_of_schizophrenia_1999.html'
>>> data.results[1].URL
'http://www.psychguides.com/sche.pdf'
My question is, how can I access all ten URLs in a single command.
Specifically, why does the following statement not work:
>>> data.results[0:10].URL
Traceback (most recent call last):
File "<pyshell#78>", line 1, in -toplevel-
data.results[0:10].URL
AttributeError: 'list' object has no attribute 'URL'
Again, I am new to Python, so a watered-down, conceptual response to this
would be greatly appreciated. Thanks in advance.
Brian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20060916/882d26df/attachment.htm
More information about the Tutor
mailing list