I am having a little trouble grasping this subject in my book. The book gives the program :
def main():
fname = raw_input("Enter filename: ")
infile = open(fname, 'r')
data = infile.read()
print data
main()
"as a program that prints the contentsof a file to the screen using the read operation". I understand the the code, but what I don't understand is what it does. When I type in a program I saved called Decoder.py, it prints the text code for Decoder. However, when I choose something like a file from Microsoft Word named BB.doc I am given an error. Why can't this program print the text from any file?