[EMAIL PROTECTED] wrote:
> I have a list y
>
y
>
> ['20001201', 'ARRO', '04276410', '18.500', '19.500', '18.500',
> '19.500', '224']
>
> from which I want to extract only the 2nd and 4th item
>
> by partially
> unpacking the list. So I tried
>
a,b = y[2,4]
Mmm, so lovely and meaningful
[EMAIL PROTECTED] wrote:
> Thank you, everyone, for resolving my question. At one point, while
> trying to solve the problem, I typed
>
> >>> y[1,3]
> Traceback (most recent call last):
> File "", line 1, in ?
> TypeError: list indices must be integers
>
> The error message gave me no clue as to
>> Thank you, everyone, for resolving my question. At one point, while
>> trying to solve the problem, I typed
>>
> y[1,3]
>>
>> Traceback (most recent call last):
>> File "", line 1, in ?
>> TypeError: list indices must be integers
>>
>> The error message gave me no clue as to what I was doin
[EMAIL PROTECTED] enlightened us with:
y[1,3]
> Traceback (most recent call last):
> File "", line 1, in ?
> TypeError: list indices must be integers
>
> The error message gave me no clue as to what I was doing wrong (in
> my mind, I was just writing out the elements of a range), and I
> tho
Paul McGuire wrote:
> Forgot one:
>
> _,_,a,_,b,_,_,_ = y
>
> There actually is some merit to this form. If the structure of y changes
> sometime in the future (specifically if a field is added or removed), this
> statement will fail noisily, calling your attention to this change. But if
> a ne
Thank you, everyone, for resolving my question. At one point, while
trying to solve the problem, I typed
>>> y[1,3]
Traceback (most recent call last):
File "", line 1, in ?
TypeError: list indices must be integers
The error message gave me no clue as to what I was doing wrong (in my
mind, I was
"Paul McGuire" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > I have a list y
> > >>>y
> > ['20001201', 'ARRO', '04276410', '18.500', '19.500', '18.500',
> > '19.500', '224']
> >
> > from which I want to extract only t
[EMAIL PROTECTED] wrote:
> I have a list y
> >>>y
> ['20001201', 'ARRO', '04276410', '18.500', '19.500', '18.500',
> '19.500', '224']
>
> from which I want to extract only the 2nd and 4th item by partially
> unpacking the list. So I tried
> >>>a,b = y[2,4]
> Traceback (most recent call last):
>
<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I have a list y
> >>>y
> ['20001201', 'ARRO', '04276410', '18.500', '19.500', '18.500',
> '19.500', '224']
>
> from which I want to extract only the 2nd and 4th item by partially
> unpacking the list. So I tried
> >>>a,b = y[2,4]
> Trace