python 数组操作

sharkandshark 2016-03-02

从数组中去指定下标的元素组成新数组

global loops
loops = []

for index, i in enumerate(origin):
        if index % 3 == 2:
            print 'index is %d, i is %s' % (index,i)
            loops.append(i)
    print loops

---------------------------------------------------------------------------------------------

origin 数组 ['www.baidu.com', '23', '8', 'www.sohu.com', '10', '9']

loops 数组 ['8', '9']

相关推荐

solarLan / 0评论 2020-09-17