我在python中搜索某些东西,以每4个数字从列表中返回结果
这里有个例子:
list=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]
I would like only [1,5,9,13,17]
So every 4 elements of list It returns me the result !
所以我想我可能需要使用运算符%,但我不知道该怎么做。
谢谢 !!
我在python中搜索某些东西,以每4个数字从列表中返回结果
这里有个例子:
list=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]
I would like only [1,5,9,13,17]
So every 4 elements of list It returns me the result !
所以我想我可能需要使用运算符%,但我不知道该怎么做。
谢谢 !!
我会用:
试试这个:
and
list
is not a good name for your variable since it's a builtin function in python.