Skip to content

Instantly share code, notes, and snippets.

@smallyunet
Created February 7, 2023 06:02
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 smallyunet/baa5487ea860194f27aa578a5aec8a01 to your computer and use it in GitHub Desktop.
Save smallyunet/baa5487ea860194f27aa578a5aec8a01 to your computer and use it in GitHub Desktop.
Decode .pkl file to .txt
import numpy, gzip
import _pickle as cPickle
list = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"]
for i in list:
filename = 'data' + str(i)
with gzip.open(filename + '.pkl.gz', 'rb') as f:
addrs = cPickle.load(f)
print(type(addrs))
for addr in addrs:
# print(addr)
with open(filename + ".txt", "a") as myfile:
myfile.write(addr + "\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment