Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- data2 = []
- with open("AllOutputMethodsObj.txt", "rb") as f:
- for _ in range(pickle.load(f)):
- data2.append(pickle.load(f))
- print (str(data2))
- for _ in range(pickle.load(f)):
- EOFError: Ran out of input
- import pickle
- objs = dict(a=1, b=2), [3, 4], {5, 6}
- pickle.dump(objs, open('test.tt', 'wb'))
- for ob in pickle.load(open('test.tt', 'rb')):
- print(ob)
- import pickle
- with open("objects.pickle", "rb") as file:
- a, b, c = pickle.load(file)
- with open("objects.pickle", "wb") as file:
- pickle.dump([a, b, c], file)
- import shelve
- with shelve.open('objects') as db:
- db['a'] = a
- ...
- db['b'] = b
- with shelve.open('objects') as db:
- a = db['a'] # read
- a += 1 # modify
- db['a'] = a # write back
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement