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

css - Text drops down with smaller window -

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

ruby on rails - Authlogic - how to make a registration and don't log in the new account? -