Created
May 27, 2014 20:36
-
-
Save jwtea/0c34cb5e94e4b03a5d60 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
def openCsvDebug(filename): | |
data = {} | |
with open("C:/Python27/pythoncbr/data/"+filename,"rb") as f: | |
reader = csv.DictReader(f) | |
for row in reader: | |
if row['Customer ID'] != "": | |
key = row['Customer ID'] | |
temp = (row['prodID'],row['Amount']) | |
data.setdefault(key, []) | |
data[key].append(temp) | |
if row['Customer ID'] == "": | |
temp = (row['prodID'],row['Amount']) | |
data[key].append(temp) | |
return data | |
orders = openCsvDebug("casesDebug.csv") | |
for key,values in orders.iteritems(): | |
print key | |
for value in values: | |
print value[0] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment