def parse_matrix(lines):
 col_headers = None
 result = []
 row_headers = []
 for line in lines:
  if (line[0] == '#'):
   continue
  if (line[0] == ' DCTB '):
   col_headers = map(strip, line.split(' DCTB ')[1:])
  else:
   entries = line.split(' DCTB ')
   result.append(map(float, entries[1:]))
   row_headers.append(entries[0])
 return (col_headers, row_headers, asarray(result))

def parse_matrix ( lines ) : col_headers = None result = [ ] row_headers = [ ] for line in lines : if ( line [ 0 ] == '#' ) : continue if ( line [ 0 ] == ' DCTB ' ) : col_headers = map ( strip , line . split ( ' DCTB ' ) [ 1 : ] ) else : entries = line . split ( ' DCTB ' ) result . append ( map ( float , entries [ 1 : ] ) ) row_headers . append ( entries [ 0 ] ) return ( col_headers , row_headers , asarray ( result ) )
parser for a matrix file tab delimited .