In [52]:
import pymongo
from pymongo import MongoClient
mongo_url = 'mongodb://localhost:27017/'
db = 'BathSim'
coll_in = 'BathHarvest'
coll_out = 'BathAuthors'
client = MongoClient(mongo_url)
ci = client[db][coll_in]
co = client[db][coll_out]
In [53]:
curs = ci.find()
In [54]:
for rec in curs[0:1000]:
print(rec['year'])
In [46]:
punct_filter = dict((ord(char), u'') for char in ' "#$%&\'()*+,./-:;<=>?@[\\]^_`{|}')
typical = [u'Abid, M. S.',
u'Ahmed, S.',
u'Ahmed, E.',
u'Hussain, S.',
u'Kiermaier, J.',
u'Matysik, F.-M.',
u'Mitchels, J.M.']
fin=[]
for i in typical:
l,f =i.split(',')
f = f.translate(punct_filter)
fin.append(f+' '+ l)
In [47]:
fin
Out[47]:
In [ ]: