I am using this function to read a config file.
import numpy as np
stream = np.genfromtxt(filepath, delimiter = '\n', comments='#', dtype= 'str')
It works pretty well but I have a problem: the tab character.
I.e. output
['\tvalue1 ', ' 1'] ['\t'] ['value2 ', ' 2']
Is there a way to ignore this special char?
My solution is something like that: (It works for my purposes but it's a bit "ugly")
result = {}
for el in stream:
    row = el.split('=',1)
    try:
        if len(row) == 2:
            row[0] = row[0].replace(' ','').replace('\t','') #clean the elements from not needed spaces
            row[1] = row[1].replace(' ','').replace('\t','')
            result[row[0]] = eval(row[1])
    except:
        print >> sys.stderr,"FATAL ERROR: '"+filepath+"' missetted" 
        logging.exception(sys.stderr)
        sys.exit('')
 
     
     
    