julia - 在 Julia 中遍历嵌套的字典

我正在使用出色的 https://github.com/JuliaIO/MAT.jl 来读取结构类似于 test2 的 mat 文件

Dict1 = Dict("a" => [1,3], "b" => 2, "c" => "Hello")
test2=Dict("test"=>Dict1,"a"=>[2,4])

使用读取命令,我可以像这样访问 Dict1:

using MAT
read(file, "test")

但我也想访问 Dict1 中的变量,如“a”或“b”。

有什么建议么?

谢谢!

回答1

dict_1 = Dict("a" => [1,3], "b" => 2, "c" => "Hello")

dict_2 = Dict("test" => dict_1, "a" => [2,4])

@show dict_2["test"]["b"]

相似文章

随机推荐

最新文章