Created
June 10, 2014 01:11
-
-
Save TheConnMan/855b79f4595462cf5093 to your computer and use it in GitHub Desktop.
Some Python to parse out those pesky characters
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
Stuff | Moar Stuff | So Much -Stuff | |
---|---|---|---|
St-uff | Moar Stuff | So Much| Stuff | |
Stuff | Moar |Stuff | So Much Stuff | |
St|uff | Mo-ar Stuff | So -Much Stuff | |
Stuff | Moar Stu|ff | So Much Stuff | |
St-uff | Moar Stuf-f | So Much |S-tuff | |
Stuff | Moar -Stuf-f | So- Much Stuff | |
St|uf-f | Moar Stuf|f | So Much Stuff | |
Stuff | |Moar -Stuff | So- Much |Stuff | |
Stuff | Moar S|tuff | So Muc|h Stuff |
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
import csv | |
# Open the raw file | |
fileReader=open('ParseDis.csv','rb') | |
# Open the writer | |
writer=open('DisBeParsed.csv','wb') | |
# Read the raw file as a CSV | |
reader=csv.reader(fileReader) | |
replaceDees=['-','|'] | |
# Get all rows | |
for row in reader: | |
line='' | |
# Get all rows | |
for col in row: | |
# Get a character to replace | |
for i in replaceDees: | |
# Replace it | |
col=col.replace(i,'') | |
# Replace it good | |
# Add it to the current line | |
line+=col+',' | |
# Write the line | |
writer.write(line+'\n') | |
# Shut it down | |
fileReader.close() | |
writer.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment