Created
May 12, 2015 10:26
-
-
Save fegoa89/ea8915ebaabb71c9e0c2 to your computer and use it in GitHub Desktop.
Create a new CSV without duplicated rows in Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# python -t format_duplicated_rows.py | |
with open('input.csv','r') as in_file, open('output.csv','w') as out_file: | |
seen = set() | |
for line in in_file: | |
if (line in seen): | |
continue | |
else: | |
seen.add(line) | |
out_file.write(line) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment