Like a matrix

Yazar Yolait yazar at hotmail.com
Sun Oct 26 01:32:30 EDT 2003


I have a string of numbers in a file like so:
0 3 23.3 352 45 4
4 45 23 54 4 5.4 .6

I need to average them horizontally and vertically.  Horizontally is easy
since I'm reading one line at a time, but how can I do it vertically like 0
and 4, 3 and 45, etc.
I was thinking of a dictionary but how do you add entries to a dictionary,
you can't can you?  Like I would add 0 to a dictionary that holds the 0th
column.  And then when I get to line 2, I would add 4 to the dictionary
which has the 0th column data.







More information about the Python-list mailing list