Friday, January 11, 2019

Python: pickle example

import pickle

links = []
if os.path.isfile('links.pkl'):
  all_content_links = pickle.load(open('links.pkl', 'r'))
else:
  links = fetch_links()
  pickle.dump(links , open('links.pkl', 'w'))

No comments: