Search code examples
pythoncsvpyscripter

How to print the first letter of an element in CSV file


Currently,I am doing a project where I am creating a music quiz. I have created an external CSV file called playlist.csv where I have stored the song and artist. I have already imported the CSV file, but I need to print the first letter of the song from the external file in Pyscripter - and I can't work out how to do this.


Solution

  • with open('playlist.csv') as mycsv:
        print(mycsv.readline()[0])