Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Ian Kelly Newsgroups: comp.lang.python Subject: Re: Pythonic love Date: Mon, 7 Mar 2016 16:13:28 -0700 Lines: 13 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de QIqf2ZvhASoRnYuU2i2GSwUeAsED9EujzGNH/IbDHPKg== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.008 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'received:209.85.223': 0.03; 'lines.': 0.07; 'none):': 0.07; 'python': 0.10; 'things.': 0.15; '2016': 0.16; '3:51': 0.16; 'itertools': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; 'skip': 0.18; 'import': 0.24; 'header:In-Reply-To:1': 0.24; 'mon,': 0.24; 'wonder': 0.27; 'message-id:@mail.gmail.com': 0.27; 'perl': 0.29; "i'd": 0.31; 'probably': 0.31; 'received:google.com': 0.35; 'but': 0.36; 'possible.': 0.36; 'received:209.85': 0.36; 'to:addr:python-list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'thanks': 0.37; 'things': 0.38; 'received:209': 0.38; 'to:addr:python.org': 0.40; 'here.': 0.62; 'more': 0.63; 'mar': 0.65; 'to:name:python': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=zv3Yo5zVEq8meydUITMWcmLjtoI1Mmpna53VOBhMQLE=; b=lgTn/L9nn2qHQ045+c0chT3CoC7a+wwCR1gu08kHT+8Y0ctB3N2TXRfnNMkILFj6nI a/ufnHQaIJ5lryq5+UMsexMI2tNq7Y5gzx6Uuqu7afglivZ17xmeiJ8JjjX1yNw66xrZ OzHfWVk5Utjo+cuX/iLnOJ6p2GxknKdJUlVAAPS4axuP/z0Z2tZxtTnh5g5A8LWSKeBL SucmmdHmmCYt+iG2Q6hOMXrUAno9hb3k57QJS7nY+GIHMAblPkiN0NaSAUIe5Tj4q+vV 1JeEIdSNE0MS/zIy1YKvyx9OVmNrcLbL+HhVsS81CVD6t1mkVibSU6rppgCoryOL6VnA 4I3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=zv3Yo5zVEq8meydUITMWcmLjtoI1Mmpna53VOBhMQLE=; b=ImywQrPGAXzjrExjgmD5/7tCDoqSsYKsuqrUIGYlS3MWFymrA85TRNK7fHzVwFsVvY tSnUaa4hgk55tmfiLPsXX30xj3kgbMkco665QUrBNayGd2VxG5EjJGoRPcCmNTSAx5/I rxvyrXcnAk8mfqL7aT2NaErMGst7HUbxOr9Rfwm2rsjtgbWawFdFovovKr5JhQs0kgr8 B5DQCn8BFERZZ8PiViVT9NbYkApQ/Nsu2uF+SiIgfZlvYhcVSJGzn6tc2MeHTlBqYlsZ HlhVBZNLeXR3NPZ45PRIjZN6kpDY7DeUHXzKf7JSsEi04V+HxNl78Y3rXS9pDtxo2Zhq 46EA== X-Gm-Message-State: AD7BkJL2VMA3dq0lafcAFaBlpERwdAouI2eNhw7MFnYa4eiaVEBN5RdmwzXIjGyp8EOUj1BR2YBdfsvWbH6Fsw== X-Received: by 10.107.19.140 with SMTP id 12mr22803754iot.11.1457392447375; Mon, 07 Mar 2016 15:14:07 -0800 (PST) In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:104267 On Mon, Mar 7, 2016 at 3:51 PM, Fillmore 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)