Pythonic love

Ian Kelly ian.g.kelly at gmail.com
Mon Mar 7 18:13:28 EST 2016


On Mon, Mar 7, 2016 at 3:51 PM, Fillmore <fillmore_remove at hotmail.com> wrote:
>
> learning Python from Perl here. Want to do things as Pythonicly as possible.
>
> I am reading a TSV, but need to skip the first 5 lines. The following works,
> but wonder if there's a more pythonc way to do things. Thanks

I'd probably use itertools.islice.

from itertools import islice
for line in isiice(pfile, 5, None):
    allVals = line.strip().split("\t")
    print(allVals)



More information about the Python-list mailing list