python - Creating a list using csv.reader() -


i'm trying create list in python csv file. csv file contains 1 column, 300 rows of data. list should (ideally) contain string of data in each row.

when execute below code, end list of lists (each element list, not string). csv file i'm using formatted incorrectly, or there else i'm missing?

filelist = []                 open(r'd:\blah\blahblah.csv', 'r') expenses:     reader = csv.reader(expenses)     row in reader:         filelist.append(row) 

row row 1 field. need first item in row:

filelist.append(row[0]) 

or more concisely:

filelist = [row[0] row in csv.reader(expenses)] 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -