# Reading a file from the CIA

# get name of file from user
fileName = input("Enter CIA file to read: ")

# now try to open it
try:
    # a line that will crash on bad user input
    ciaFile = open(fileName,"r")
except:
    # ends up in this block if file open failed
    print("Cannot find file")
    ciaFile = None # the None value means the variable is empty

# only read the file if the open succeeded
if ciaFile != None:  # succeeded in opening
    
    # for loop to read a file - so short!
    for line in ciaFile:
        print(line)
    # close file when done reading
    ciaFile.close()
