标签:col 键值 white set yii tps http dict name
https://www.yiibai.com/tcl/tcl_dictionary.html
词典是用于值映射到建的布置。
常规字典的语法: dict set dictname key value
dict create dictname key1 value1 key2 value2 .. keyn valuen
用于创建字典的例子:
#!/usr/bin/tclsh
dict set colours colour1 red
puts $colours
dict set colours colour2 green
puts $colours
set colours [dict create colour1 "block" colour2 "white"]
puts $colours
输出:
colour1 red
colour1 red colour2 green
colour1 black colour2 white
字典的大小:
[dict size dictname]
字典迭代:
[dict get $dictname $keyname]
set colurs [dict create colur1 "black" colour2 "white"]
foreach item [dict keys $colours] {
set value [dict get $colours $item]
puts $value
}
输出:
black
white
字典的键值:
[dict get $dictname $keyname]
标签:col 键值 white set yii tps http dict name
原文地址:https://www.cnblogs.com/lelin/p/11739152.html