1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
"""An emulation of the csv.reader module.
"""
__author__ = 'Florian Krause <florian@expyriment.org>, \
Oliver Lindemann <oliver@expyriment.org>'
__version__ = '0.7.0'
__revision__ = '55a4e7e'
__date__ = 'Wed Mar 26 14:33:37 2014 +0100'
def reader(the_file):
'''
This is a 'dirty' emulation of the csv.reader module only used for
Expyriment loading designs under Android. The function reads in a csv file
and returns a 2 dimensional array.
Parameters
----------
the_file: iterable
The file to be parsed.
Notes
-----
It is strongly suggested the use, if possible, the csv package from the
Python standard library.
'''
delimiter = ","
rtn = []
for row in the_file:
rtn.append(map(lambda strn: strn.strip(), row.split(delimiter)))
return rtn
|