dictionary to read 3 values from a csv file in python
Question: I'm trying to create a simple dictionary which gets 3 values from a csv file.
my python code can get 2 values easily from the csv file. But I can't get to
display a 3th value.

Heres my csv file :

    
    
      ERRORCODE,EVENTKEY,COUNT 
    
        109,playback_error,2
        210,live_channels_metadata_request_failed,1
        106,playback_error,19
        180,search_error,5
        2086,vod_catalog_metadata_request_failed,1
        -1001,live_channels_metadata_request_failed,1
        380,playback_error,1
        400,search_error,2
        N/A,crash,218
        3803,playback_error,28
        JX-0002,search_error,104
        385,playback_error,141
        386,playback_error,1
        387,playback_error,29
        0,tbr_error,31
        2001,qp_library_failed_to_start,42
        2002,qp_library_failed_to_start,147
        1512,playback_error,19
        2004,live_channels_metadata_request_failed,2
        2006,qp_library_failed_to_start,1
        2006,live_channels_metadata_request_failed,5
        -1001,search_error,2
        -1003,search_error,8
        BLL-10011,parental_controls_error,42
        1517,playback_error,47
        ,,81
        BL-10013,parental_controls_error,3
        -1005,search_error,3
        BL-10014,parental_controls_error,2
        3320,qp_library_failed_reauthentication,2
        3710,playback_error,168
        -1200,playback_error,2
        -1,playback_error,2
        3301,playback_error,1311
        3304,playback_error,122
        3305,playback_error,1
    

Here's my python dictionary:

    
    
    #!/usr/bin/python
    import csv
    with open('csv_err2.log', mode='r') as infile:
        reader = csv.reader(infile)
        mydict = dict((rows[0],rows[1]) for rows in reader)
    print(mydict)
    

I'm only able to get the following ouput: ERRORCODE, EVENTKEY:

    
    
    { '3904': 'playback_error', '3808': 'playback_error', '3902': 'qp_library_failed_to_start'..... }
    

but i'm missing the value COUNT.. :( How can I display my last value COUNT in
that dictionary?

any help would be greatly appreciated


Answer: 
    mydict = dict((rows[0],rows[1:]) for rows in reader)
    

might be what you are looking for ... not really sure

