def is_column_based(fname, sep=' DCTB ', skip=0, is_multi_byte=False):
 headers = get_headers(fname, sep, is_multi_byte=is_multi_byte)
 count = 0
 if (not headers):
  return False
 for hdr in headers[skip:]:
  if (hdr and hdr[0] and (not hdr[0].startswith('#'))):
   if (len(hdr) > 1):
    count = len(hdr)
   break
 if (count < 2):
  return False
 for hdr in headers[skip:]:
  if (hdr and hdr[0] and (not hdr[0].startswith('#'))):
   if (len(hdr) != count):
    return False
 return True

def is_column_based ( fname , sep = ' DCTB ' , skip = 0 , is_multi_byte = False ) : headers = get_headers ( fname , sep , is_multi_byte = is_multi_byte ) count = 0 if ( not headers ) : return False for hdr in headers [ skip : ] : if ( hdr and hdr [ 0 ] and ( not hdr [ 0 ] . startswith ( '#' ) ) ) : if ( len ( hdr ) > 1 ) : count = len ( hdr ) break if ( count < 2 ) : return False for hdr in headers [ skip : ] : if ( hdr and hdr [ 0 ] and ( not hdr [ 0 ] . startswith ( '#' ) ) ) : if ( len ( hdr ) != count ) : return False return True
see if the file is column based with respect to a separator .