Read a dictionary JLD2 file dumped by python in julia

Hi,

I am trying to import a dictionary that I saved in python with the extension .jld2
First, I tried this code to do that:

> using JSON
> using DataStructures
> using JLD2
> dict_name = load("path/dict_name.jld2")

And, throw me this error:

UndefVarError: load not defined

Then, I tried with this:

> using JSON
> using DataStructures
> using JLD2
> dict_name = @load "path/dict_name.jld2" 

But it is imported as an array object.

Could you help me with the correct code to import it as a dictionary?

Simply changing the extension won’t give you a proper JLD2 file.

1 Like

it was a mistake when writing it
Now I corrected it in the first post, I still have the doubt …

how did you create a JLD2 file from python? JLD2 is a julia pkg

1 Like