第一次上传只有5分..因为貌似OwlTest的评分要求是需要用orderedDict的~
所以需要用到collections.OrderedDict()来创建字典~
"""
Project for Week 3 of "Python Data Analysis".
Read and write CSV files using a dictionary of dictionaries.
Be sure to read the project description page for further information
about the expected behavior of the program.
"""
import collections
import csv
def read_csv_fieldnames(filename, separator, quote):
"""
Inputs:
filename - name of CSV file
separator - character that separates fields
quote - character used to optionally quote fields
Ouput:
A list of strings corresponding to the field names in
the given CSV file.
"""
with open(filename, "r") as csvfile:
csvreader = csv.reader(csvfile, delimiter=separator, quotechar=quote)
result = list(csvreader)[0]
return result
def read_csv_as