[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.python

Re: Traversing python datatypes via http

Alan Gauld

2/6/2008 12:25:00 AM

"Mark" <mobiledreamers@gmail.com> wrote

> Is it possible to traverse say python lists via http://

http is a network protocol.
What does that have to do with traversing python lists?
Can you clarify what you mean by that?

> say there is a list in the memory
> can we traverse the list using list/next list/prev list/first
> list/last

Not with a standard list although its not hard to do by defining
your own class wrappibng a list.

You can however traverse a list using a standard for loop:

for item in [1,2,3,4,5]:
print item

And you can use range() to generate a set of indices
that will allow you to iterate by more unusual step sizes
And you can use normal indexing to go to the first element(0)
or the last element(-1)

I'm not sure if that answers your question.

--
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/...