Skip to content

Instantly share code, notes, and snippets.

@siddhantkushwaha
Created December 14, 2020 15:39
Show Gist options
  • Save siddhantkushwaha/43a59b6c7af9f45f6e35a7709e96bd9f to your computer and use it in GitHub Desktop.
Save siddhantkushwaha/43a59b6c7af9f45f6e35a7709e96bd9f to your computer and use it in GitHub Desktop.
import pickle
ckpt = '/content/drive/MyDrive/mydumps/ck1.pickle'
def load():
with open(ckpt, 'rb') as fp:
chk = pickle.load(fp)
return chk
def exists(key):
chk = load()
return key in chk
def save(key):
try:
chk = load()
except:
chk = set()
chk.add(key)
with open(ckpt, 'wb') as fp:
pickle.dump(chk, fp)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment