def cmpfunc(item1,item2): return cmp(item1["term"].lower(),item2["term"].lower()) interm=0 terms=[] term={} fh=file("intergo.dct","r") cnt=1 for ln in fh.readlines(): if ln[0]=="#": pass elif len(ln.strip())==0: if interm: term["number"]=cnt cnt+=1 terms.append(term) term={} interm=0 else: if not interm: interm=1 items=ln.split("=",1) if len(items)==2: [key,value]=items value=value.strip() key=key.strip() if len(value)!=0: if term.has_key(key): if type(term[key])==type([]): term[key].append(value) else: term[key]=[term[key],value] else: term[key]=value fh.close() header="""
" if item.has_key("GB"): if type(item["GB"])==type([]): for st in item["GB"]: print >>fh,st else: print >>fh,item["GB"] print >>fh,"
" if item.has_key("GF"): if type(item["GF"])==type([]): for st in item["GF"]: [fname,other]=st.split(" ",1) print >>fh,"
" else: [fname,other]=item["GF"].split(" ",1) print >>fh,"
" print >>fh,"
" if item.has_key("CP"): if type(item["CP"])==type([]): for st in item["CP"]: print >>fh,st else: print >>fh,"
"+item["CP"] print >>fh,"
" if item.has_key("RF"): if type(item["RF"])==type([]): for st in item["RF"]: print >>fh,"
%s" % (st,st)
else:
print >>fh,"%s
" % (item["RF"],item["RF"])
print >>fh,"