Last active
June 15, 2017 00:23
-
-
Save rtorres90/fd419ca1133a170591d33eb13d1f310b to your computer and use it in GitHub Desktop.
Handling files with pickles.
This file contains hidden or 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 pickle | |
a,b,c,d=[1],[3],[5],[7] | |
a.append(2) | |
b.append(4) | |
c.append(6) | |
d.append(8) | |
with open('test.pk','wb') as fo: | |
pickle.dump(a,fo) | |
pickle.dump(b,fo) | |
pickle.dump(c,fo) | |
pickle.dump(d,fo) | |
with open('test.pk', "rb") as f: | |
while True: | |
try: | |
#Insert your code to handle the pickles. | |
print pickle.load(f) | |
except EOFError: | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment