diff --git a/challenge.py b/challenge.py new file mode 100644 index 0000000..1359817 --- /dev/null +++ b/challenge.py @@ -0,0 +1,37 @@ +import csv +import argparse +import json + +# Defines and gives a description to the argument challenge.py +parser = argparse.ArgumentParser(prog='challenge.py', + description="Filters and prints out the .tsv file in a JSON file.", + exit_on_error=True) + +# Add an argument and give a help message that explains the purpouse of the (tsv) argument list. +parser.add_argument('tsv', action="store", help="Required command to filter and print out the .tsv file in a JSON file.") + +# Parses the argument and returns an object with it's values. +args = parser.parse_args() + +def filterWriteFile(): + + # Open input2.tsv path file in read only mode. + with open("./input/input2.tsv", "r") as inputFile: + # Create the .json file in write only mode. + with open("output.json", "w+") as outputFile: + # Reading input2.tsv file with the cvs library, giving it a delimiter of tab. + file = csv.DictReader(inputFile, delimiter='\t') + + # For in loop in file + for line in file: + # Dump the filtered information in the JSON file. + json.dump(line, outputFile, indent=6) + + + outputFile.close() + inputFile.close() + + return 1 + + +filterWriteFile() \ No newline at end of file diff --git a/output.json b/output.json new file mode 100644 index 0000000..c285719 --- /dev/null +++ b/output.json @@ -0,0 +1,441 @@ +{ + "first": "", + "middle": "", + "last": "Drager C-Stores, LLC", + "organization": "N/A", + "address": "304 Challenger Place", + "city": "Longmont", + "state": "CO", + "county": "", + "zip": "80501", + "zip4": "" +}{ + "first": "Shannon", + "middle": "Lee", + "last": "Tucker", + "organization": "N/A", + "address": "2560 E Olive St", + "city": "Decatur", + "state": "IL", + "county": "Macon", + "zip": "62526", + "zip4": "5349" +}{ + "first": "Katherine", + "middle": "Elaine", + "last": "Geter", + "organization": "N/A", + "address": "4650 S. Pinnacle Hills Pkwy 206", + "city": "Rogers", + "state": "Arkansas", + "county": "", + "zip": "72758", + "zip4": "" +}{ + "first": "", + "middle": "", + "last": "Rincon Jimenez Enterprises LLC", + "organization": "N/A", + "address": "6191 W Atlantic Blvd # 1", + "city": "Margate", + "state": "Florida", + "county": "", + "zip": "33063", + "zip4": "" +}{ + "first": "LaQuisha", + "middle": "N/M/N", + "last": "Harris", + "organization": "N/A", + "address": "300 36th Ave NE", + "city": "Center Point", + "state": "AL", + "county": "", + "zip": "35215", + "zip4": "1412" +}{ + "first": "Jannely", + "middle": "N/M/N", + "last": "Montes", + "organization": "N/A", + "address": "3060 Arthur Ct APT# A3", + "city": "Waukegan", + "state": "IL", + "county": "", + "zip": "60085", + "zip4": "" +}{ + "first": "", + "middle": "", + "last": "Wholesale Intertrade Distributor, Inc.", + "organization": "N/A", + "address": "1351 Pony Trail Pl.", + "city": "El Paso", + "state": "TX", + "county": "", + "zip": "79936", + "zip4": "6982" +}{ + "first": "Abraham", + "middle": "N/M/N", + "last": "Franks", + "organization": "N/A", + "address": "1303 Fifth Street", + "city": "Hiller", + "state": "PA", + "county": "", + "zip": "15444", + "zip4": "9733" +}{ + "first": "Leonard", + "middle": "N/M/N", + "last": "Beasley", + "organization": "N/A", + "address": "319 TICKETT AVE", + "city": "Greenwood", + "state": "MS", + "county": "", + "zip": "38930", + "zip4": "" +}{ + "first": "Paul", + "middle": "Logan", + "last": "Cardwell", + "organization": "N/A", + "address": "305 Liberty Street", + "city": "Franklin", + "state": "KY", + "county": "", + "zip": "42134", + "zip4": "" +}{ + "first": "COLIN", + "middle": "ALLAN", + "last": "PARKER", + "organization": "N/A", + "address": "1440 W. IRVINGTON RD.", + "city": "TUCSON", + "state": "Arizona", + "county": "", + "zip": "85746", + "zip4": "4100" +}{ + "first": "Sabrina", + "middle": "N/M/N", + "last": "Renfroe", + "organization": "N/A", + "address": "15470 E. Temple Place", + "city": "Aurora", + "state": "Colorado", + "county": "", + "zip": "80015", + "zip4": "" +}{ + "first": "Elena", + "middle": "N/M/N", + "last": "Jackson", + "organization": "N/A", + "address": "716 Blossom Ct.", + "city": "Naperville", + "state": "IL", + "county": "", + "zip": "60540", + "zip4": "" +}{ + "first": "", + "middle": "", + "last": "", + "organization": "Artisan Builders, LLC", + "address": "14362 N. Frank Lloyd Wright Blvd., #1000", + "city": "Scottsdale", + "state": "AZ", + "county": "", + "zip": "85260", + "zip4": "8847" +}{ + "first": "Jeremy", + "middle": "L.", + "last": "Wehmeyer", + "organization": "N/A", + "address": "227 2nd St", + "city": "Atalissa", + "state": "IA", + "county": "", + "zip": "52720", + "zip4": "" +}{ + "first": "Josefina", + "middle": "Garcia", + "last": "Montes", + "organization": "N/A", + "address": "12746 1/2 Kalnor Ave", + "city": "Norwalk", + "state": "CA", + "county": "", + "zip": "90650", + "zip4": "" +}{ + "first": "Alastair", + "middle": "T.", + "last": "Crawford", + "organization": "N/A", + "address": "115 West Front Street", + "city": "Oil City", + "state": "PA", + "county": "", + "zip": "16301", + "zip4": "" +}{ + "first": "", + "middle": "", + "last": "CB&I Holdco, LLC", + "organization": "N/A", + "address": "757 North Eldridge Parkway", + "city": "Houston", + "state": "TX", + "county": "", + "zip": "77079", + "zip4": "4527" +}{ + "first": "Arnulfo", + "middle": "Hernandez", + "last": "Dacanay,", + "organization": "N/A", + "address": "446 Capitol Village Circle", + "city": "San Jose", + "state": "CA", + "county": "", + "zip": "95136", + "zip4": "" +}{ + "first": "", + "middle": "", + "last": "", + "organization": "CRC MEDIA WEST. LLC", + "address": "8145 EAST EVANS SUITE 8", + "city": "SCOTTSDALE", + "state": "AZ", + "county": "", + "zip": "85260", + "zip4": "" +}{ + "first": "Brian", + "middle": "Lane", + "last": "Bonner", + "organization": "N/A", + "address": "824 Bonneville Drive", + "city": "Mobile", + "state": "AL", + "county": "", + "zip": "36695", + "zip4": "" +}{ + "first": "Gary", + "middle": "R.", + "last": "Brown", + "organization": "N/A", + "address": "5661 Seapine Rd.", + "city": "Hilliard", + "state": "OH", + "county": "Franklin", + "zip": "43026", + "zip4": "" +}{ + "first": "", + "middle": "", + "last": "Frontier Communications of Lakewood, LLC", + "organization": "N/A", + "address": "401 Merritt 7", + "city": "Norwalk", + "state": "CT", + "county": "", + "zip": "06851", + "zip4": "1000" +}{ + "first": "Jose", + "middle": "N/M/N", + "last": "Gutierrez", + "organization": "N/A", + "address": "PO BOX 7553", + "city": "Redlands", + "state": "CA", + "county": "", + "zip": "92375", + "zip4": "0553" +}{ + "first": "Ralphel", + "middle": "N/M/N", + "last": "Johnson", + "organization": "N/A", + "address": "20611 Beigewood Dr", + "city": "Humble", + "state": "TX", + "county": "Harris", + "zip": "77338", + "zip4": "" +}{ + "first": "Maria", + "middle": "De Los Angeles", + "last": "Najera", + "organization": "N/A", + "address": "10340 Canoga Ave, Apt 220", + "city": "Chatsworth", + "state": "California", + "county": "Los Angeles", + "zip": "91311", + "zip4": "2281" +}{ + "first": "Shirley", + "middle": "Merritt", + "last": "Willaby", + "organization": "N/A", + "address": "104 Joshua Tree Ct", + "city": "Forney", + "state": "Texas", + "county": "", + "zip": "75126", + "zip4": "0200" +}{ + "first": "Binh", + "middle": "N/M/N", + "last": "Lam", + "organization": "N/A", + "address": "75 Chimney Walk Court", + "city": "Suwanee", + "state": "GA", + "county": "", + "zip": "30024", + "zip4": "" +}{ + "first": "Svetoslav", + "middle": "Viktorov", + "last": "Ivanov", + "organization": "N/A", + "address": "342 Ospreys Landing Apt 2105", + "city": "Naples", + "state": "FL", + "county": "", + "zip": "34104", + "zip4": "" +}{ + "first": "Lisa", + "middle": "M", + "last": "Arebaugh", + "organization": "N/A", + "address": "2602 E. Township Road 148", + "city": "Tiffin", + "state": "OH", + "county": "", + "zip": "44883", + "zip4": "" +}{ + "first": "Steven", + "middle": "Gustav", + "last": "Broman", + "organization": "N/A", + "address": "11035 Grape Way", + "city": "Thornton", + "state": "Colorado", + "county": "Adams", + "zip": "80233", + "zip4": "" +}{ + "first": "", + "middle": "", + "last": "", + "organization": "Symmetrix Technologies, LLC", + "address": "106 N Denton Tap Rd Suite 210-262", + "city": "Coppell", + "state": "TX", + "county": "", + "zip": "75019", + "zip4": "" +}{ + "first": "Adam", + "middle": "Ray", + "last": "Richardson", + "organization": "N/A", + "address": "P.O. Box 682", + "city": "Waldron", + "state": "AR", + "county": "", + "zip": "72958", + "zip4": "" +}{ + "first": "Rhodes", + "middle": "Taylor", + "last": "Carter", + "organization": "N/A", + "address": "3321 Huntley Square Drive APT A1", + "city": "Temple Hills", + "state": "MD", + "county": "", + "zip": "20748", + "zip4": "6213" +}{ + "first": "David", + "middle": "N/M/N", + "last": "Amundson", + "organization": "N/A", + "address": "25363 Woodward Ave.", + "city": "Lomita", + "state": "California", + "county": "", + "zip": "90717", + "zip4": "" +}{ + "first": "", + "middle": "", + "last": "", + "organization": "Spring Business Group LLC", + "address": "204 Rockville Springs Dr.", + "city": "Eatonton", + "state": "GA", + "county": "", + "zip": "30124", + "zip4": "8219" +}{ + "first": "Ashley", + "middle": "N/M/N", + "last": "Bond", + "organization": "N/A", + "address": "7717 S Kingston Ave Apt 3", + "city": "Chicago", + "state": "IL", + "county": "", + "zip": "60649", + "zip4": "" +}{ + "first": "", + "middle": "", + "last": "Central Trading Company Ltd.", + "organization": "N/A", + "address": "1501 North Division Street", + "city": "Plainfield", + "state": "Illinois", + "county": "", + "zip": "60544", + "zip4": "3890" +}{ + "first": "Robert", + "middle": "Eugene", + "last": "Warren", + "organization": "N/A", + "address": "1807 West 5000 South", + "city": "Roy", + "state": "UT", + "county": "", + "zip": "84067", + "zip4": "" +}{ + "first": "", + "middle": "", + "last": "WD-I Associates, LLC", + "organization": "N/A", + "address": "1055 Laskin Road, Suite 100", + "city": "Virginia Beach", + "state": "VA", + "county": "", + "zip": "23451", + "zip4": "6369" +} \ No newline at end of file