Skip to content

Instantly share code, notes, and snippets.

@jwtea
Created May 27, 2014 20:36
Show Gist options
  • Save jwtea/0c34cb5e94e4b03a5d60 to your computer and use it in GitHub Desktop.
Save jwtea/0c34cb5e94e4b03a5d60 to your computer and use it in GitHub Desktop.
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