请教如何以二进制模式打开文件

我在python中用pickle保存了字典对象。

Python 代码:

import pickle
with open(“ddd.dat”,“wb”) as f:
       pickle.dump(data, f)

现在我想在Julia中打开在python这保存的文件,但是Julia的open好像不支持二进制模式。

Julia 代码:

非常感谢

open("ReadBinary.txt", "r+") do io
    write(io, "Hello, world!"); seek(io, 0)
    
    println(read(io, String)); seek(io, 0)
    println(read(io, 4)); seek(io, 0)
    println(read(io)); seek(io, 0)
    println(read(io, UInt8)); seek(io, 0); 
end

输出

Hello, world!
UInt8[0x48, 0x65, 0x6c, 0x6c]
UInt8[0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x2c, 0x20, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x21]
72

read 可用的参数见文档

ref:

找到方法了,感谢各位!!!

using PyCall
@pyimport pickle
open("ddd.dat","r") do f
    global data = pickle.loads(read(f))
end

https://discourse.julialang.org/t/unable-to-load-pickle-data/4620/2