def load_settings(path):
 if os.path.exists(path):
  comments = (lambda s: (s and (not s.startswith('#'))))
  settings = filter(comments, open(path, 'r'))
  return dict(((k.strip(), v.strip()) for (k, _, v) in [s.partition('=') for s in settings]))
 return {}

def load_settings ( path ) : if os . path . exists ( path ) : comments = ( lambda s : ( s and ( not s . startswith ( '#' ) ) ) ) settings = filter ( comments , open ( path , 'r' ) ) return dict ( ( ( k . strip ( ) , v . strip ( ) ) for ( k , _ , v ) in [ s . partition ( '=' ) for s in settings ] ) ) return { }
take given file path and return dictionary of any key=value pairs found .