Skip to content

Instantly share code, notes, and snippets.

@RobBlackwell
Created May 29, 2018 17:20
Show Gist options
  • Save RobBlackwell/05568a2f057304e769df8166a1d135d8 to your computer and use it in GitHub Desktop.
Save RobBlackwell/05568a2f057304e769df8166a1d135d8 to your computer and use it in GitHub Desktop.
using PyCall
@pyimport pickle
# This works for complex objects such as Scikit learn models. REB
# 20171129
function mypickle(filename, obj)
out = open(filename,"w")
pickle.dump(obj, out)
close(out)
end
function myunpickle(filename)
r = nothing
@pywith pybuiltin("open")(filename,"rb") as f begin
r = pickle.load(f)
end
return r
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment