def fields_to_dict(lines, delim=' DCTB ', strip_f=strip):
 result = {}
 for line in lines:
  if strip_f:
   fields = map(strip_f, line.split(delim))
  else:
   fields = line.split(delim)
  if (not fields[0]):
   continue
  result[fields[0]] = fields[1:]
 return result

def fields_to_dict ( lines , delim = ' DCTB ' , strip_f = strip ) : result = { } for line in lines : if strip_f : fields = map ( strip_f , line . split ( delim ) ) else : fields = line . split ( delim ) if ( not fields [ 0 ] ) : continue result [ fields [ 0 ] ] = fields [ 1 : ] return result
makes a dict where first field is key .