I\'m overriding the csv.Dictreader.fieldnames
property like the following to read all headers from csv files without white space and in lower case.
You'll have to do it in two steps:
dict
specialisation with a __getitem__
method that applies the .strip().lower()
to the its key
parameter.__next__
on your MyDictReader
specialised class to return one of your special dictionaries initialised with the dictionary returned by the csv.DictReader
superclass's __next__
method.