# # file: read-from-file.py # This program opens a file "numbers.dat", reads all the information from it # and displays it on the screen. # !!! Please, note the the input file "numbers.dat" should be stored in the # same place your program is. # # The program uses read() function def main(): in_stream=open("numbers.dat","r") # opening the file "numbers.dat" string=in_stream.read() # reading everything from the file, and # string variable refers to that content print "The contents of the file %s is:" % ("numbers.dat") print string # outputting everything that string variable refers to main()