Slice List (v3)

The Slice List node extracts a part of a list.

How to use the Slice List (v3) node

Connect your list to the data_list socket.

 

This node slices out a partial list, clearly defined by a range defining from where to where the list should be “cut out”.

Let’s assume a list of 6 characters:

input: data_list
["A", "B", "C", "D", "E", "F"]
Notion image

With the two inputs, from and to we can define from which index to where the slice should be extracted. Let’s set from to 2 and to to 5.

The slice is returned inclusive of both indices. So in our case, the result is:

output: data_list
["C", "D", "E", "F"]
⚠️
Note that indices start at 0, i.e. the first element lives at index 0, the second element at index 1 etc.
⚠️
Note you can use -1 to specify the “end of the list” without explicitly knowing how long the list is. Use -2 to specify the second to last element etc.
 
Did this answer your question?
😞
😐
🤩

Last updated on January 31, 2023