In article [EMAIL PROTECTED],
Shawn Milochik [EMAIL PROTECTED] wrote:
.
.
.
Just for my own sanity: Isn't this the third response advocating the
use of enumerate()? Did the other responses not get through, or was
this a
On Aug 14, 11:59 am, Shawn Milochik [EMAIL PROTECTED] wrote:
Just for my own sanity: Isn't this the third response advocating the
use of enumerate()? Did the other responses not get through, or was
this a time-delay thing?
Thanks,
Shawn
Look at the timestamps. All within ten minutes. And
En Wed, 15 Aug 2007 10:37:16 -0300, Cameron Laird [EMAIL PROTECTED]
escribi�:
Shawn Milochik [EMAIL PROTECTED] wrote:
Just for my own sanity: Isn't this the third response advocating the
use of enumerate()? Did the other responses not get through, or was
this a time-delay thing?
Yes, for a
Dennis Lee Bieber schreef:
On Wed, 15 Aug 2007 13:39:57 -0300, Gabriel Genellina
[EMAIL PROTECTED] declaimed the following in comp.lang.python:
Never underestimate the bandwidth of a station wagon full of tapes
hurtling down the highway
(Andrew S. Tanenbaum, Computer Networks, 1996; maybe
In article [EMAIL PROTECTED],
BartlebyScrivener [EMAIL PROTECTED] wrote:
On Aug 14, 11:59 am, Shawn Milochik [EMAIL PROTECTED] wrote:
Just for my own sanity: Isn't this the third response advocating the
use of enumerate()? Did the other responses not get through, or was
this a time-delay
Hi,
I just started with python, and have a for loop question
In c++ (or a number of other languages) I can do this:
for (int i=0, j=0; i i_len, j j_len; ++i, ++j) {}
If I have this in python:
l = ['a', 'b', 'c']
I want to get the value and also an iterator:
for i,v in len(l), l:
On Aug 14, 10:22 am, Bryan [EMAIL PROTECTED] wrote:
Hi,
I just started with python, and have a for loop question
In c++ (or a number of other languages) I can do this:
for (int i=0, j=0; i i_len, j j_len; ++i, ++j) {}
If I have this in python:
l = ['a', 'b', 'c']
I want to get the
Bryan [EMAIL PROTECTED] wrote:
How do I do this?
for i, item in enumerate(l):
print i, item
--
Lawrence, oluyede.org - neropercaso.it
It is difficult to get a man to understand
something when his salary depends on not
understanding it - Upton Sinclair
--
On Tue, Aug 14, 2007 at 12:22:04PM -0400, Bryan wrote:
I just started with python, and have a for loop question
In c++ (or a number of other languages) I can do this:
for (int i=0, j=0; i i_len, j j_len; ++i, ++j) {}
If I have this in python:
l = ['a', 'b', 'c']
I want to get the
On Aug 14, 11:27 am, [EMAIL PROTECTED] (Lawrence Oluyede) wrote:
Bryan [EMAIL PROTECTED] wrote:
How do I do this?
for i, item in enumerate(l):
print i, item
^^ That is the `most-correct` answer. But because you're new, I'll
take this time to introduce you to help(), just in case
On 8/14/07, Bryan [EMAIL PROTECTED] wrote:
Hi,
I just started with python, and have a for loop question
In c++ (or a number of other languages) I can do this:
for (int i=0, j=0; i i_len, j j_len; ++i, ++j) {}
If I have this in python:
l = ['a', 'b', 'c']
I want to get the value and
or use its builtin enumerate function:
for i, j in enumerate(list):
print i, j
--Jim
On Aug 14, 2007, at 9:26 AM, [EMAIL PROTECTED] wrote:
On Aug 14, 10:22 am, Bryan [EMAIL PROTECTED] wrote:
Hi,
I just started with python, and have a for loop question
In c++ (or a number of other
snip
this will get index and item at index,
for i in range(0, len(l)):
print i
print l[i]
--
http://mail.python.org/mailman/listinfo/python-list
Enumerate is better here -- it provides the same result and that's
what it's for. However, if you do use range, the zero is
snip
Use the enumerate() builtin.
l = ['a', 'b', 'c']
for i, v in enumerate(l):
... print i, v
...
0 a
1 b
2 c
--
Just for my own sanity: Isn't this the third response advocating the
use of enumerate()? Did the other responses not get through, or was
14 matches
Mail list logo