Dec-11-2018, 09:50 PM
Here is the code I am using
The problem is that the output starts somewhere in the middle of the file.
Here are the first 5 lines of the input file file.
with open('summary.txt') as f: reader = csv.DictReader(f, delimiter=',') data = [row for row in reader] for i in data: print(i)The file contains 10,000 lines so I won't post all of the output.
The problem is that the output starts somewhere in the middle of the file.
')]) OrderedDict([('ID', '8346'), ('Time', '2018/11/03 20:54'), ('Record Type', '0'), ('Historic Glucose (mg/dL)', '114'), ('Scan Glucose (mg/dL)', ''), ('Non-numeric Rapid-Acting Insulin', ''), ('Rapid-Acting Insulin (units)', ''), ('Non-numeric Food', ''), ('Carbohydrates (grams)', ''), ('Non-numeric Long-Acting Insulin', ''), ('Long-Acting Insulin (units)', ''), ('Notes', ''), ('Strip Glucose (mg/dL)', ''), ('Ketone (mmol/L)', ''), ('N/A', ''), ('Previous Time', ''), ('Updated Time', '')]) OrderedDict([('ID', '8347'), ('Time', '2018/11/03 21:09'), ('Record Type', '0'), ('Historic Glucose (mg/dL)', '116'), ('Scan Glucose (mg/dL)', ''), ('Non-numeric Rapid-Acting Insulin', ''), ('Rapid-Acting Insulin (units)', ''), ('Non-numeric Food', ''), ('Carbohydrates (grams)', ''), ('Non-numeric Long-Acting Insulin', ''), ('Long-Acting Insulin (units)', ''), ('Notes', ''), ('Strip Glucose (mg/dL)', ''), ('Ketone (mmol/L)', ''), ('N/A', ''), ('Previous Time', ''), ('Updated Time', '')]) OrderedDict([('ID', '8348'), ('Time', '2018/11/03 21:24'), ('Record Type', '0'), ('Historic Glucose (mg/dL)', '127'), ('Scan Glucose (mg/dL)', ''), ('Non-numeric Rapid-Acting Insulin', ''), ('Rapid-Acting Insulin (units)', ''), ('Non-numeric Food', ''), ('Carbohydrates (grams)', ''), ('Non-numeric Long-Acting Insulin', ''), ('Long-Acting Insulin (units)', ''), ('Notes', ''), ('Strip Glucose (mg/dL)', ''), ('Ketone (mmol/L)', ''), ('N/A', ''), ('Previous Time', ''), ('Updated Time', '')]) OrderedDict([('ID', '8349'), ('Time', '2018/11/03 21:39'), ('Record Type', '0'), ('Historic Glucose (mg/dL)', '136'), ('Scan Glucose (mg/dL)', ''), ('Non-numeric Rapid-Acting Insulin', ''), ('Rapid-Acting Insulin (units)', ''), ('Non-numeric Food', ''), ('Carbohydrates (grams)', ''), ('Non-numeric Long-Acting Insulin', ''), ('Long-Acting Insulin (units)', ''), ('Notes', ''), ('Strip Glucose (mg/dL)', ''), ('Ketone (mmol/L)', ''), ('N/A', ''), ('Previous Time', ''), ('Updated Time', '')]) OrderedDict([('ID', '8350'), ('Time', '2018/11/03 21:54'), ('Record Type', '0'), ('Historic Glucose (mg/dL)', '148'), ('Scan Glucose (mg/dL)', ''), ('Non-numeric Rapid-Acting Insulin', ''), ('Rapid-Acting Insulin (units)', ''), ('Non-numeric Food', ''), ('Carbohydrates (grams)', ''), ('Non-numeric Long-Acting Insulin', ''), ('Long-Acting Insulin (units)', ''), ('Notes', ''), ('Strip Glucose (mg/dL)', ''), ('Ketone (mmol/L)', ''), ('N/A', ''), ('Previous Time', ''), ('Updated Time', '')]) OrderedDict([('ID', '8351'), ('Time', '2018/11/03 22:09'), ('Record Type', '0'), ('Historic Glucose (mg/dL)', '163'), ('Scan Glucose (mg/dL)', ''), ('Non-numeric Rapid-Acting Insulin', ''), ('Rapid-Acting Insulin (units)', ''), ('Non-numeric Food', ''), ('Carbohydrates (grams)', ''), ('Non-numeric Long-Acting Insulin', ''), ('Long-Acting Insulin (units)', ''), ('Notes', ''), ('Strip Glucose (mg/dL)', ''), ('Ketone (mmol/L)', ''), ('N/A', ''), ('Previous Time', ''), ('Updated Time', '')]) OrderedDict([('ID', '8352'), ('Time', '2018/11/03 22:24'), ('Record Type', '0'), ('Historic Glucose (mg/dL)', '170'), ('Scan Glucose (mg/dL)', ''), ('Non-numeric Rapid-Acting Insulin', ''), ('Rapid-Acting Insulin (units)', ''), ('Non-numeric Food', ''), ('Carbohydrates (grams)', ''), ('Non-numeric Long-Acting Insulin', ''), ('Long-Acting Insulin (units)', ''), ('Notes', ''), ('Strip Glucose (mg/dL)', ''), ('Ketone (mmol/L)', ''), ('N/A', ''), ('Previous Time', ''), ('Updated Time', '')]) OrderedDict([('ID', '8353'), ('Time', '2018/11/03 22:39'), ('Record Type', '0'), ('Historic Glucose (mg/dL)', '168'), ('Scan Glucose (mg/dL)', ''), ('Non-numeric Rapid-Acting Insulin', ''), ('Rapid-Acting Insulin (units)', ''), ('Non-numeric Food', ''), ('Carbohydrates (grams)', ''), ('Non-numeric Long-Acting Insulin', ''), ('Long-Acting Insulin (units)', ''), ('Notes', ''), ('Strip Glucose (mg/dL)', ''), ('Ketone (mmol/L)', ''), ('N/A', ''), ('Previous Time', ''), ('Updated Time', '')])Not sure where the ')]) is coming from or why it doesn't show the first part of the file.
Here are the first 5 lines of the input file file.
140,2018/07/28 03:12,0,79,,,,,,,,,,,,,,, 141,2018/07/28 03:27,0,71,,,,,,,,,,,,,,, 142,2018/07/28 03:42,0,69,,,,,,,,,,,,,,, 143,2018/07/28 03:57,0,72,,,,,,,,,,,,,,, 144,2018/07/28 04:14,1,,79,,,,,,,,,,,,,,Thanks
Gary