Posted to tcl by venks at Sun Mar 15 18:10:38 GMT 2015view raw
- proc dict_print_fo {fo pfx d} {
- if {[catch {set keys [dict keys $d]}]} {
- return 1
- } else {
- foreach key $keys {
- if {[dict_print_fo $fo $pfx.$key [set val [dict get $d $key]]]} {
- puts $fo "$pfx.$key=$val"
- }
- }
- return 0
- }
- }
- proc dict_print {fn d prefix} {
- set fo [open $fn w]
- dict_print_fo $fo $prefix $d
- close $fo
- }