import csv


def get_csv_log_file_data(folder_list):
    """ The Function takes a list of folders and returns combined list of entries 
    and the folder of the entry, taken from from the driving_log.csv file."""
    
    csv_lines = []
    
    # For the driving_log.csv file from imput list of folders:
    # In this case ['training_data_middle', 'training_data_opposite', 'training_data_recover']
    # The first folder has training samples to train the network to drive car in the middle of the road
    # The second folder has data by driving the car in the clock wise direction on track one
    # The third folder has samples to teach car to recover to middle of road from sides.
    for val in folder_list:
        print('./{}/driving_log.csv'.format(val))
        with open('./{}/driving_log.csv'.format(val)) as csvfile:
            reader = csv.reader(csvfile)
            for line in reader:
                csv_lines.append([line, './{}/'.format(val)])
    return csv_lines