By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,661 Members | 779 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,661 IT Pros & Developers. It's quick & easy.

numbers to matrix

P: 1
I have 2 files and i have to calulate mean of numbers stored in these files

like :

file 1: x y
12.33 12.33
23.44 344444

file 2: x y
122.33 344.55
122.33 344.55

add 00 location of file 1 to 00 location of file 2 and finding mean .

so how can i approached it??
Nov 11 '14 #1
Share this Question
Share on Google+
1 Reply


bvdet
Expert Mod 2.5K+
P: 2,851
Start by reading each file as in:
Expand|Select|Wrap|Line Numbers
  1. for filename in  filelist:
  2.     # create file object
  3.     f = open(filename, "r")
  4.     data = f.read()
You will then parse the data and store the result in a suitable object such as a list or dictionary.
Nov 11 '14 #2

Post your reply

Sign in to post your reply or Sign up for a free account.