Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python3
- fout= open("F1.csv","w", encoding="ISO-8859-2")
- finp= open("F1_.csv", encoding="ISO-8859-2")
- d=';'
- szurj={}
- for index,line in enumerate(finp):
- if index==0:
- continue
- line=line.strip()
- x=line.split(";")
- try:
- szurj[x[0]+d+x[3]+d+x[6]+d+x[8]]
- except KeyError:
- szurj[x[0]+d+x[3]+d+x[6]+d+x[8]]=x[7]
- else:
- if int(szurj[x[0]+d+x[3]+d+x[6]+d+x[8]])<int(x[7]):
- szurj[x[0]+d+x[3]+d+x[6]+d+x[8]]=x[7];
- finp.close()
- finp= open("F1_.csv", encoding="ISO-8859-2")
- for index,line in enumerate(finp):
- line=line.strip()
- if index==0:
- print(line,file=fout)
- continue
- x=line.split(";")
- if szurj[x[0]+d+x[3]+d+x[6]+d+x[8]]!=x[7]:
- continue
- s=";".join(x)
- print(s,file=fout)
- fout.close()
- finp.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement