Skip to content

Instantly share code, notes, and snippets.

@thomasweng15
Last active January 9, 2023 15:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thomasweng15/73c7504f38b9637a6d65ad7486896340 to your computer and use it in GitHub Desktop.
Save thomasweng15/73c7504f38b9637a6d65ad7486896340 to your computer and use it in GitHub Desktop.
edit a pickle
# best run in an interpreter or with a breakpoint
import pickle
fn = ''
with open(fn, 'rb') as f:
a = pickle.load(f)
# make edits
# breakpoint()
# a = a[:len(a)-1]
pickle.dump(a, open(fn, 'wb'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment