
## Import module for handling csv files.
import csv
## You are not allowed to import any other module into this file.

## display_playlist( filename )
## Replace the following dummy function with one that reads the playlist
## from the csv file corresponding to the filename argument and prints
## out the playlist in the format shown in the coursework specification
## document.
##
## Note: Check whether the filename argument ends in ".csv". If it doesn't
## then you should add ".csv" to get the actual name of the CSV file that
## will be opened.

def display_playlist( filename ):
     ## Replace the next line with code to produce the table.
     ## The fully specification can be implemented in 20 lines or less.
     ## That is just a guideline, the length of your code will not affect
     ## your grade.
     print( '\n Running  display_playlist( "{}" )'.format(filename) )



## You can use the following function to read data from a csv format file
def get_datalist_from_csv( filename ):
    ## Create a 'file object' f, for accessing the file: 
    with open( filename ) as f:  
         reader = csv.reader(f)     # create a 'csv reader' from the file object
         datalist = list( reader )  # create a list from the reader 
    return datalist


## The following function may be useful for aligning your table columns
## It adds spaces to the end of a string to make it up to length n.
def pad_to_length( string, n):
    return string + " "* (n-len(string)) ## s*n gives empty string for n<1 

## Run the display_playlist function on the example files
## (The ".csv" should get added by display_playlist)
## display_playlist( "geek-music.csv" )
## display_playlist( "snake-music")




