user9900698
user9900698

Reputation:

Accessing values from nested dictionary in TCL

I have the following dictionary in TCL:

main_dict {sub_dict1 {key1 val1 key2 val2 key3 val3} subdict2 {key1 val1}}

How can I access the val3 which is inside my sub_dict1?

Upvotes: 0

Views: 671

Answers (1)

Shawn
Shawn

Reputation: 52529

Using dict get with multiple keys:

% set mydict {main_dict {sub_dict1 {key1 val1 key2 val2 key3 val3} subdict2 {key1 val1}}}
main_dict {sub_dict1 {key1 val1 key2 val2 key3 val3} subdict2 {key1 val1}}
% dict get $mydict main_dict sub_dict1 key3
val3

Upvotes: 1

Related Questions