Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from __future__ import print_function
- import os
- import pickle
- import importlib
- import csv
- import tablib
- def read():
- for ls in os.listdir('corpus/rnews'):
- if ls.endswith('.pkl'):
- f = open('corpus/rnews' + ls, 'rb')
- data = pickle.load(f)
- for datum in data:
- print('time = {}, title = {}'.format(datum['ts'], datum['title']))
- f.close()
- headers = ('time','title')
- data = [f]
- data = tablib.Dataset(*data, headers=headers)
- f.write("/corpus/")
- writer = csv.writer(f)
- if __name__ == '__main__':
- _build_csv()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement