Hmm, those are the values that are odd, he wanted the values from odd
indices, eg:

>>> a=[2,3,4,5,6,7]
>>> filter(lambda x: x%2, a)
[3, 5, 7]
>>> [ val for val, i in itertools.izip(a, itertools.count()) if not i % 2 ]
[2, 4, 6]

That could probably be written a bit nicer..

On Thu, Dec 9, 2010 at 10:44 AM, Cal Leeming [Simplicity Media Ltd]
<cal.leem...@simplicitymedialtd.co.uk> wrote:
>>>> mylist = [1,2,3,4,5,6,7,8]
>>>> filter(lambda x: x%2, mylist)
> [1, 3, 5, 7]
>>>>
>
> This what you need?
>
> On 09/12/2010 10:34, Phani Chand wrote:
>>
>> i am passing though a list{1,2,3,4} but i want only the numbers with odd
>> index in template written in html --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-us...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to