Source code for FileHandler

'''
  File Openers; BSP
'''
[docs]def OpenCol(filename,col): ''' OpenCol takes in filename in columb (col) ''' data=[line.split() for line in open(filename)] return [float(datum[col]) for datum in data]
[docs]def Open2Col(filename,col1,col2): """ Open2Col returns the values for two columns from """ data=[line.split() for line in open(filename)] c1=[float(datum[col1]) for datum in data] c2=[float(datum[col2]) for datum in data] return c1,c2
[docs]def OpenTryData(filename): ''' Try to open data ''' data=[line.split() for line in open(filename)] for d in data: for datum in d: try: datum=float(datum) except: pass return data