On Dec 4, 2:22 pm, Joel Davis <callmeclaud...@gmail.com> wrote:
> Is it possible to run a list comprehension over a certain portion of
> the list? My goals is to be able to run the comprehension on the
> innermost elements of the list, but leaving the outermost intact.

Something like this?

>>> a
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> b = [i for i in a[0:5]]
>>> b
[0, 1, 2, 3, 4]
>>> c = [i for i in a if i%2==0]
>>> c
[0, 2, 4, 6, 8]
>>>
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to