excel - Python CSV module: How can I account for multiple tables within the same file? -


i have excel file converted csv. there several tables each separated empty row. after converting excel file csv, see each empty row represented row of commas, comma every column/field element. can csv module (or other python module) account multiple tables information? if not, option separate tables different files manually in excel before conversion?

i know csv module turn each row list. i'd table own list , rows has lists within. each table has first row fields. fields can different table table, , number of fields can different well.

sure, it's easy read data in way. have decide constitutes separator row (is sufficient check first column being empty, or have check columns empty?) assuming first row (and being verbose clarity):

 rdr = csv.reader(open(filename))   tables = []  this_table = []  tables.append(this_table)  row in rdr:       if row[0] none:          this_table = []          tables.append(this_table)       this_table.append(row) 

the result list called tables. each entry list containing data 1 table. each entry in table list containing column values 1 row.


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -