kitir/_libs/file_utils.py
def read_csv(file_name, return_headers=False, **kwargs):
    """
    reads a csv file using DictReader and returns a rowdicts list
    :param file_name: path of the file
    :param return_headers: return value becomes (rows, headers)
    :return: rows read from csv
    """
    filemode = kwargs.pop('filemode', 'r')
    log.trace('reading csv file: path={}'.format(file_name))
    with open(file_name, filemode) as f:
        # verify file is not empty
        if not check_file_size(file_name):
            log.warning('csv file size is 0 bytes: csv={}'.format(file_name))
            if return_headers:
                return [], []
            return []

        reader = DictReader(f)
        rows = [row for row in reader]
    if return_headers:
        return rows, reader.fieldnames
    return rows

    reads a csv file using DictReader and returns a rowdicts list
    :param file_name: path of the file
    :param return_headers: return value becomes (rows, headers)
    :return: rows read from csv
    
reads a csv file using DictReader and returns a rowdicts list
reads a csv file using DictReader and returns a rowdicts list
def read_csv(file_name, return_headers=False, **kwargs):
    filemode = kwargs.pop('filemode', 'r')
    log.trace('reading csv file: path={}'.format(file_name))
    with open(file_name, filemode) as f:
        if not check_file_size(file_name):
            log.warning('csv file size is 0 bytes: csv={}'.format(file_name))
            if return_headers:
                return [], []
            return []
        reader = DictReader(f)
        rows = [row for row in reader]
    if return_headers:
        return rows, reader.fieldnames
    return rows
def read_csv ( file_name , return_headers = False , ** kwargs ) : filemode = kwargs . pop ( 'filemode' , 'r' ) log . trace ( 'reading csv file: path={}' . format ( file_name ) ) with open ( file_name , filemode ) as f : if not check_file_size ( file_name ) : log . warning ( 'csv file size is 0 bytes: csv={}' . format ( file_name ) ) if return_headers : return [ ] , [ ] return [ ] reader = DictReader ( f ) rows = [ row for row in reader ] if return_headers : return rows , reader . fieldnames return rows
reads a csv file using DictReader and returns a rowdicts list
reads a csv file using DictReader and returns a rowdicts list
"""
    reads a csv file using DictReader and returns a rowdicts list
    :param file_name: path of the file
    :param return_headers: return value becomes (rows, headers)
    :return: rows read from csv
    """ # verify file is not empty
rows read from csv
rows read from csv
file_name
path of the file
path of the file
return_headers
return value becomes (rows, headers)
return value becomes ( rows headers )