# Return the contents of the named text file def fileContents(filename): # Get the file object that corresponds to the file name # We open it for reading as a text file. (We could also # open binary files using "b" instead of "t" and we could # open for writing, using "w" instead of "r") fileObject = open(filename, "rt") # Get the (possibly very long) text string that the file # contains by reading it contents = fileObject.read() #contents = fileObject.readlines() #contents = fileObject.readline() return contents