Python Forum

Full Version: dictionary to storred data
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi All

i just start python and if possible help with dictionary

INPUT FILE
THE 1-3 KEY value
1 2 3
ABC E 00001
ABC E 00003
ABC B 00001
ABC B 00005
ABC N 00001
ABC W 00001
XYZ E 00001
XYZ B 00001
XYZ N 00001
XYZ W 00001

Reading file i need to store value build in dictionary

need counts how many ABC E COUNTS AND ADD filed 3
need counts how many ABC B COUNTS AND ADD filed 3
need counts how many ABC W COUNTS AND ADD filed 3
need counts how many ABC N COUNTS AND ADD filed 3

need counts how many XYZ E COUNTS AND ADD filed 3
need counts how many XYZ B COUNTS AND ADD filed 3
need counts how many XYZ W COUNTS AND ADD filed 3
need counts how many XYZ N COUNTS AND ADD filed 3



AT END I NEED TO READ dictionary

AND WRITE FILES

the data should be dictionary


ABC E 2 00004
ABC B 2 00006
ABC N 1 00001
ABC W 1 00001
XYZ E 1 00001
XYZ B 1 00001
XYZ N 1 00001
XYZ W 1 00001


Please help Any idea how i should start with this?

Thank you
Make an effort, show what you come up with and where specifically you need help
Hi

Thank you

I build the table like This

letterDic2 = {'PIN': {'E': [10,20]}}
letterDic2 = {'PIN': {'B: [0,0]}}
letterDic2 = {'PIN': {'W': [5,10]}}
letterDic2 = {'PIN': {'N': [10,20]}}

The count will be stored in each value [0] [1]

At end i want to read all rows in the dictionary and look for index[0] each row not 0 then do ........

What is the correct way doing this