Hi
I'm new to Python and have the following problem. I have a excel file (csv format) that I want to open and display as a 2d list. I can read the file but can not get anyother output other than the colum headings as a single letter
[h][e][a][d][i][n][g]

I would like to display the file in a list as it is in the file:
[[heading1][heading2][heading3]

    [the]   [cat]   [sat]


[on]     [the]   [mat]]

I have the following code but can't seem to get it to work as I wish



# Use the a file reader function to open the file, assign the file a name
        MetaDataStationList = open('C:\filename###.csv','r')



            # Use in csv libaray to read the file into a 2D list
            data = csv.reader('data')

            # Assign file_data to the read file filename
            data =[data]

            # Close the file using the close function
            file name.close()

            # Print the file_data

            print data


            # Close the file using the close function
            file name.close()

im stack and need some help please
I tried doing things like; for I in row

                                 print row

but no luck

For what you describe, I would eschew the csv module. Generally, split and append:

fid=open(<filename>)
lstOfLines=[]
for record in fid:
    lstOfLines.append(record.strip("\n").split(","))
fid.close()
This article has been dead for over six months. Start a new discussion instead.