def parse_csv(self,text):
"""
Parse the table source text and return a list of rows, each row
is a list of Cells.
"""
import StringIO
import csv
rows = []
rdr = csv.reader(StringIO.StringIO('\r\n'.join(text)),
delimiter=self.parameters.separator, skipinitialspace=True)
try:
for row in rdr:
rows.append([Cell(data) for data in row])
except Exception:
self.error('csv parse error: %s' % row)
return rows
评论列表
文章目录