Skip to content

Instantly share code, notes, and snippets.

@Keycatowo
Created February 1, 2022 09:14
Show Gist options
  • Save Keycatowo/e36c57773bcba9ac3b750307c2dbe388 to your computer and use it in GitHub Desktop.
Save Keycatowo/e36c57773bcba9ac3b750307c2dbe388 to your computer and use it in GitHub Desktop.
讀寫pickle檔案
# 讀寫pickle檔案
import pickle
# save
with open('example.pkl', 'wb') as f:
# 記得是用dump不是save
pickle.dump(file=f, obj=data) # file:檔案handle, obj:變數名稱
# read
with open('example.pkl', 'rb') as f:
data = pickle.load(f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment