Last active
July 29, 2017 02:26
-
-
Save jesuscast/071f6fc42607d641337949f612b7a8b4 to your computer and use it in GitHub Desktop.
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 | |
import pprint | |
import os, sys, re | |
def RETSLY_Parser(filename): | |
lines_tmp = [] | |
with open(filename, "r+") as f: | |
lines_tmp = f.read().split('\n') | |
lines = [] | |
strings=("id","parcelID","county","landValue","improvementValue","totalValue","full","coordinates","areaSquareFeet","yearBuilt") | |
for line in lines_tmp: | |
add_line = False | |
if any(s in line for s in strings): | |
add_line = True | |
if add_line: | |
lines.append(line) | |
return "\n".join(lines) | |
if __name__=="__main__": | |
filename = sys.argv[1] | |
full_path = os.path.join(os.getcwd(), filename) | |
print "Parsing file: %s" % full_path | |
cleaned_text = RETSLY_Parser(full_path) | |
print cleaned_text |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment