Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

can is slice list with list of indices python

lst = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']
indices = [0, 2, 6]
out = [lst[i] for i in indices]
 
PREVIOUS NEXT
Tagged: #slice #list #list #indices #python
ADD COMMENT
Topic
Name
2+6 =