In an effort to learn how to work with information in files, I am writing a program that opens an already existing file containing decimal numbers. It then takes the decimals, sorts them, and returns median and mean.
Here's what I have so far:
So...I have the list part accomplished. string.split(se p) yields the information as a list. But I don't know how to take these data from the list and make each decimal number it's own string.
I am still a bit new to python, so maybe I am going about this the wrong way...or maybe it's obvious?
Here's what I have so far:
Code:
#opening file as a read only file
f = open('testfile', 'r')
#assigns variable to string
numbers = f.read(testfile)
#Make a list where each decimal is its own string
numbers.split(",")
I am still a bit new to python, so maybe I am going about this the wrong way...or maybe it's obvious?
Comment