Answers for "Tcl get part of list"

0

Tcl get part of list

% Make Arbitrary List
set ListA {10 20 30 40 50 60};
puts $ListA;

% Select Range of values based on index positions: (N.B. First element of list has index 0)
set start_index 2; 		% Select Start Index (2 Corresponds to 3rd item in list)
set end_index 5; 		% Select End Index 	(5 Corresponds to 6th ithem in list)

% SPlit List
set ListA_Part [lrange $ListA $start_index $end_index];
puts $ListA_Part
Posted by: Guest on August-14-2020

Python Answers by Framework

Browse Popular Code Answers by Language