I'm trying to select some elements from a string list given a list of indexes. For example:
String=['a','b','c']
Id = [1,2]
s = String [Id]
It gives the error :
list indexes must be integers or slices, not list.
How can I resolve it?
I'm trying to select some elements from a string list given a list of indexes. For example:
String=['a','b','c']
Id = [1,2]
s = String [Id]
It gives the error :
list indexes must be integers or slices, not list.
How can I resolve it?
You can do:
String=['a','b','c']
Id = [1,2]
s = [String[id] for id in Id]