How could I create variables from keys and values of a dictionary? Is the following extract (like PHP) possible?
julia> d = Dict(
"key1" =>111,
"key2" =>222,
"key3" =>333
);
julia> extract(d)
julia> key1, key2, key3
(111,222,333)
k = collect(keys(d))
v = collect(values(d))
Both keys and values return iterators. collect then produces an array.
But note that you often do not need to do this and can just iterate through the dictionary using
for (k, v) in d
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With