On Thu, Nov 11, 2010 at 11:01 AM, alex23 <wuwe...@gmail.com> wrote:
> +1 on this approach. Clear and obvious and not reliant on any library
> modules other than sys.
>
> itertools, what WAS I thinking? :)

maybe:

import sys
from itertools import islice

print [v for v in islice((line for line in sys.stdin), 0, 5)]

?

-- 
-- James Mills
--
-- "Problems are solved by method"
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to