Path: csiph.com!2.eu.feeder.erje.net!feeder.erje.net!1.eu.feeder.erje.net!newsfeed0.kamp.net!newsfeed.kamp.net!fu-berlin.de!uni-berlin.de!not-for-mail From: Bob Gailer Newsgroups: comp.lang.python Subject: Re: Exclude every nth element from list? Date: Sat, 26 Mar 2016 13:03:17 -0400 Lines: 7 Message-ID: References: <94237154-22af-4e64-85ee-9b4cf334fa6f@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de j8Ocpqmwp+AO1RcvOYnm2wl/qK/mhsQbpOkhPDHdBCOA== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.017 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'cc:addr:python-list': 0.09; 'email addr:python.org>': 0.10; '12:50': 0.16; '2016': 0.16; 'cc:name:python list': 0.16; 'email addr:python.org>': 0.16; 'excludes': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; 'element': 0.18; '>': 0.18; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'select': 0.23; 'header:In-Reply- To:1': 0.24; 'subject:list': 0.26; 'message-id:@mail.gmail.com': 0.27; 'list': 0.34; 'received:google.com': 0.35; 'there': 0.36; 'received:209.85': 0.36; 'subject:?': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'skip:& 10': 0.37; 'received:209.85.213': 0.37; 'list.': 0.37; 'received:209': 0.38; 'subject:from': 0.39; 'mar': 0.65; 'to:addr:aol.com': 0.66; 'email name:python-list': 0.67; '26,': 0.72 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=WbuC1SuqZkA6cCm5HfS+Za5TqFAix40pChy4+B32qaI=; b=YDNFKaVFCsrtXVUzE4YaNAPk6Z49NShEA1TSoHZ7jUNSDj9m9OOUISCPoBTbPgBO5Y sqHj140lg651WQOXyM/SHvU+U3QA8aGGxjf3lAtbXHQSl2R9vCKmx/l5OX4Dh8CrhxCg 84yA9q/GeWaH9TCMefjLkKWOKyDx/GfWwdLDHntRbXre+r9x4Tr1tzEqxM0dmXp8cax/ ECFLBXYvJJiesktsrWPKKIQXTJnIVimY4+NYzc836F2lV2AHxse5Us8uzvDSy4laoEbE VSpUzFAahOz/zHnL7fijYe4/RWlzlHtAU63nv9d9n4eq/ZjJ8hP7b81CKxWOG4h7VHC+ S+YA== 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:date :message-id:subject:from:to:cc; bh=WbuC1SuqZkA6cCm5HfS+Za5TqFAix40pChy4+B32qaI=; b=bTwO0AszEsKVg2NSYrz5mc4n0yHuflYYcQJhUXb2y6SFJDvDdf9iQE1od1CM6oKA72 DSJv493eSzf2KRZokEnKkbidTVEvfoT7+aztYO4usAKJbNgcJ9+f87ZCPIP7syuUyY42 /f1zUtsWBQy3Zq3QzONvZr5ltg0tGboTqEZ5TsaNXcGVyUATHIeBxuoyAVtRGQFl6gIb dlNyflN0lDKNK9LmXpJn19Sc+Tqoflva6WRMeXp6v2J8V9hIttMSecq1BQeQAMojVZYN toCMHvyjKrAqvNXwjy5IH6HCM00NqJfBJQ0+sY8speJFK5SE/Q13kIwKjeywGaVgnHMl 3DIA== X-Gm-Message-State: AD7BkJJylXdPbO2t0HLtl4EZeXn6kzytuorjJioxes6KHxYvG/RJjDuUJ/hIJJdBmgqAUEpD596H0sLSRuiEqg== X-Received: by 10.50.17.8 with SMTP id k8mr2239876igd.39.1459011797425; Sat, 26 Mar 2016 10:03:17 -0700 (PDT) In-Reply-To: <94237154-22af-4e64-85ee-9b4cf334fa6f@googlegroups.com> X-Content-Filtered-By: Mailman/MimeDel 2.1.21 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:105768 On Mar 26, 2016 12:50 PM, "beliavsky--- via Python-list" < python-list@python.org> wrote: > > I can use x[::n] to select every nth element of a list. Is there a one-liner to get a list that excludes every nth element? [y for (i,y) in enumerate(x) if i % n]