Initializing multiple python dictionaries to the same keynames and values
Question: I want to be able to loop through my main function and _bin_ values to certain
keys in these dictionaries. All six dictionaries have the same keynames but
the dictionaries are unique. Is there a better way to 1. initialize all the
dictionaries (i.e dictionary comprehension) or 2. store this data in a better
way (i.e. nested dictionaries, namedtuples...)

Here is my current dictionary initialization:

    
    
    TRI_1 = {'HF' : 0, 'NHF' : 0, 'TF' : 0, 'HM' : 0, 'NHM' : 0, 'TM' : 0}
    TRI_2 = {'HF' : 0, 'NHF' : 0, 'TF' : 0, 'HM' : 0, 'NHM' : 0, 'TM' : 0}
    TRV_1 = {'HF' : 0, 'NHF' : 0, 'TF' : 0, 'HM' : 0, 'NHM' : 0, 'TM' : 0}
    TRV_2 = {'HF' : 0, 'NHF' : 0, 'TF' : 0, 'HM' : 0, 'NHM' : 0, 'TM' : 0}
    TRV_3 = {'HF' : 0, 'NHF' : 0, 'TF' : 0, 'HM' : 0, 'NHM' : 0, 'TM' : 0}
    TRV_4 = {'HF' : 0, 'NHF' : 0, 'TF' : 0, 'HM' : 0, 'NHM' : 0, 'TM' : 0}
    

EDIT: My Solution. I will remember g.d.d.c.'s method in the future but I need
to have keys for the initial zero values so I can simply print TRI_1 and have
{'key' : 0 } appear. This is a combination of Padraic's dictionary templating
and Aleksi's comprehension. Thank you for the simple expandable solution!

    
    
    TEMP = dict.fromkeys('HF NHF TF HM NHM TM'.split(), 0)
    TRI_1, TRI_2, TRV_1, TRV_2, TRV_3, TRV_4 = ([dict(TEMP) for i in range(6)])
    


Answer: I think I'd use this:

    
    
    from collections import defaultdict
    container = defaultdict(lambda: defaultdict(int))
    

Then you do this to tally:

    
    
    container['TRV_1']['HF'] += 1
    

