Exclude every nth element from list?
BartC
bc at freeuk.com
Sat Mar 26 13:50:03 EDT 2016
More information about the Python-list mailing list
Sat Mar 26 13:50:03 EDT 2016
- Previous message (by thread): Exclude every nth element from list?
- Next message (by thread): Exclude every nth element from list?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 26/03/2016 16:49, beliavsky at aol.com wrote: > I can use x[::n] to select every nth element of a list. I would use x[n-1::n] if 'nth' means the 3rd element of [10,20,30,40,...] is 30. Otherwise every selection will include the first, no matter what n is. -- Bartc
- Previous message (by thread): Exclude every nth element from list?
- Next message (by thread): Exclude every nth element from list?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list