def csv2st(csvfile, headers=False, stubs=False, title=None):
 rows = list()
 with open(csvfile, 'r') as fh:
  reader = csv.reader(fh)
  if (headers is True):
   headers = next(reader)
  elif (headers is False):
   headers = ()
  if (stubs is True):
   stubs = list()
   for row in reader:
    if row:
     stubs.append(row[0])
     rows.append(row[1:])
  else:
   for row in reader:
    if row:
     rows.append(row)
  if (stubs is False):
   stubs = ()
 nrows = len(rows)
 ncols = len(rows[0])
 if any(((nrows != ncols) for row in rows)):
  raise IOError('All rows of CSV file must have same length.')
 return SimpleTable(data=rows, headers=headers, stubs=stubs)

def csv2st ( csvfile , headers = False , stubs = False , title = None ) : rows = list ( ) with open ( csvfile , 'r' ) as fh : reader = csv . reader ( fh ) if ( headers is True ) : headers = next ( reader ) elif ( headers is False ) : headers = ( ) if ( stubs is True ) : stubs = list ( ) for row in reader : if row : stubs . append ( row [ 0 ] ) rows . append ( row [ 1 : ] ) else : for row in reader : if row : rows . append ( row ) if ( stubs is False ) : stubs = ( ) nrows = len ( rows ) ncols = len ( rows [ 0 ] ) if any ( ( ( nrows != ncols ) for row in rows ) ) : raise IOError ( 'All rows of CSV file must have same length.' ) return SimpleTable ( data = rows , headers = headers , stubs = stubs )
return simpletable instance .