Created
February 7, 2023 06:02
-
-
Save smallyunet/baa5487ea860194f27aa578a5aec8a01 to your computer and use it in GitHub Desktop.
Decode .pkl file to .txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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