def parse_preference(path):
 storage = {}
 read = open(path)
 for line in read:
  line = line.strip()
  if line.startswith('<string name="'):
   index = line.find('"', 14)
   key = line[14:index]
   value = line[(index + 2):(-9)]
   storage[key] = value
 read.close()
 return storage

def parse_preference ( path ) : storage = { } read = open ( path ) for line in read : line = line . strip ( ) if line . startswith ( '<string name="' ) : index = line . find ( '"' , 14 ) key = line [ 14 : index ] value = line [ ( index + 2 ) : ( - 9 ) ] storage [ key ] = value read . close ( ) return storage
parse androids shared preference xml .