Python's open() function opens a file for reading (or writing)
file.readlines() reads the entire contents of file into a list of strings
inputfile = open("data.txt", "r")
data = inputfile.readlines()
inputfile.close()
for line in data:
print line
The string package contains functions for manipulating strings
string.split() breaks up a string, based on a separating character, into a list of strings
string.atoi() converts a string to an integer
string.atof() converts a string to a floating point number
import string
for line in data:
strvalues = string.split(line)
for str in strvalues:
x = string.atoi(str)
print x