def _fileToMatrix(file_name):
 if (1 < 3):
  lres = []
  for line in open(file_name, 'r').readlines():
   if ((len(line) > 0) and (line[0] not in ('%', '#'))):
    lres.append(list(map(float, line.split())))
  res = lres
 else:
  fil = open(file_name, 'r')
  fil.readline()
  lineToRow = (lambda line: list(map(float, line.split())))
  res = list(map(lineToRow, fil.readlines()))
  fil.close()
 while ((res != []) and (res[0] == [])):
  del res[0]
 return res
 print(('could not read file ' + file_name))

def _fileToMatrix ( file_name ) : if ( 1 < 3 ) : lres = [ ] for line in open ( file_name , 'r' ) . readlines ( ) : if ( ( len ( line ) > 0 ) and ( line [ 0 ] not in ( '%' , '#' ) ) ) : lres . append ( list ( map ( float , line . split ( ) ) ) ) res = lres else : fil = open ( file_name , 'r' ) fil . readline ( ) lineToRow = ( lambda line : list ( map ( float , line . split ( ) ) ) ) res = list ( map ( lineToRow , fil . readlines ( ) ) ) fil . close ( ) while ( ( res != [ ] ) and ( res [ 0 ] == [ ] ) ) : del res [ 0 ] return res print ( ( 'could not read file ' + file_name ) )
rudimentary method to read in data from a file .