csv.read_table

View page source

Create A Table from a CSV File

Prototype

# at_cascade.csv.read_table
def read_table(file_name) :
   assert type(file_name)  == str
   # ...
   assert type(table) == list
   return table

file_name

is a str with the name of the CSV file. The first line of the file is the header line and the others contain the data. The header value in the j-th column of the first line is the corresponding column name.

table

the return value table is a list of dict. We use n to denote the length of the list which is the number of lines in the file minus one. For i, an int , between zero and n -1, and each column name key , a string, table [ i ][ key ] is the str in line i +2 and column key.

Example

csv.table