从lis中删除每三个元素

2024-04-24 23:19:04 发布

您现在位置:Python中文网/ 问答频道 /正文

在这段代码中,我在一个列表中打印索引号。在

x = '1 2 3 4 67 8'
x = list(map(int, x.split()))
# something here with modulo??
print(x)

输出: [1,2,3,4,67,8]

我想输出 [1,2,4,67]

所以第三个元素,第六个,第九个等等。。。在


Tags: 代码元素map列表herewithsomethinglist