def harvest(self, limit=None, offset=None):
"""
Harvest the data from the file
:param offset: Integer offset for the row - starts from 0
:param limit: Interger limit of the rows to iterate over - starts from 0
:return: list of tuples containing CAS number and IUPAC name
"""
response = []
for i, row in enumerate(list(self.reader)[offset:]):
if limit:
if i == limit:
break
cas = row[0].split(' ', 1)[0]
cut_start_iupac = str(row[0].split('(', 1)[1])
iupac = cut_start_iupac.rsplit(')', 1)[0]
response.append({
"CAS": cas,
"IUPAC": iupac
})
return response
评论列表
文章目录