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