python本身不支持列表或元祖作为列表索引
def list_indice(x,y):
"""
python not suport list or tuple as indice,use this function to do this job
x:a list will be indiced
y:a list or tuple as indice,you shoul know that y list must all integer!!! or rise error
"""
return [x[i] for i in y]
网友评论