mplewis / csvtomd

📝📊 Convert your CSV files into Markdown tables.
MIT License
655 stars 90 forks source link

IndexErrors occur when files with uneven row-length are parsed #2

Closed kevana closed 9 years ago

kevana commented 10 years ago

Example file contents:

a,b,c
d,e
f,g,h

Traceback:

Traceback (most recent call last):
  File "./csvtomd.py", line 126, in <module>
    print(md_table(csv, padding=args.padding))
  File "./csvtomd.py", line 79, in md_table
    row[cell_num] = pad_to(cell, col_sizes[cell_num])
IndexError: list index out of range
mplewis commented 10 years ago

Yep. We can fix this in two ways:

I like the idea of padding rows to make sure we work even if the table is kinda malformed.

mplewis commented 9 years ago

This has been taken care of by #4.