Getting all records
Whereas the dict keys
command returns a listing of all keys contained within a dictionary, the dict values
command will return a listing of all stored values. The syntax is as follows:
dict values dictionaryValue
How to do it…
In the following example we will create a dictionary containing collections of key/value pairs and then using the dict values
command we will obtain a list of all values stored within the dictionary. Return values from the commands are provided for clarity. Enter the following command:
% set test [dict create 1 one 2 two 3 three] 1 one 2 two 3 three % dict values $test one two three
How it works…
The dict values
command will return a list of all values stored within the dictionary specified in dictionaryValue
.