Re: Delete duplicate rows in textfile - except it contains a "{" or "}"

2012-10-10 Thread Joon Ki Choi
lines_seen = set() # holds lines already seen outfile = open("literatur_clean.txt", "w") for line in open("literatur_dupl.txt", "r"): if ('{' in line or '}' in line) or line not in lines_seen: outfile.write(line) lines_seen.add(line) outfile.close() -- http://mail.python.org/ma

Delete duplicate rows in textfile - except it contains a "{" or "}"

2012-10-10 Thread Joon Ki Choi
Hello Pythonistas, i have a very large textfile with contents like: @INBOOK{Ackermann1999-b, author = {Ackermann, K.-F. and Ackermann, K.-F. and Ackermann, K.-F. and Ackermann, K.-F. and Ackermann, K.-F. and Ackermann, K.-F. and Ackermann, K.-F. and Ackermann, K.-F. and Ackerm