How to read .csv file and use as list in Python

0

I need Python to read a CSV file and use the data in it as a list.

Sample CSV data

francisco,
carlos,
melo,
luis,
claudia,

I need to read Python after reading this data as follows:

lista = (['francisco','carlos','melo','luis','claudia'])

I ran into situations that he uttered line by line or had a line break \n disrupting or the comma ended up within the single quote: 'francisco,'. .................................................. ......................

People after hoooooras breaking their heads get what they wanted. As I'm getting started the details turn out to be big things.

I did this and it worked for me:

arq_listas = open('C:/...arq_listas.csv', 'r')
lista = arq_listas.read().split(',\n')
arq_listas.close()

The result I got was:

lista = (['francisco','carlos','melo','luis','claudia',''])

Thank you for your attention.

    
asked by anonymous 16.03.2018 / 01:34

0 answers