import sys

filename = 'info.txt'
mode = 'r'  # read mode

# Step 1) Open the file
# Step 2) Verify successful file open 
try:
    infoInputFileObj = open( filename, mode )

    # Step 3) Read from or write to the file
    nameLine = infoInputFileObj.readline()    # reads a single line
    amazingLine = infoInputFileObj.readline() # reads a single line
    emptyLine = infoInputFileObj.readline()   # reads a single line
except:
    print('ERROR! Unable to open or read from', filename)
    sys.exit()

# Step 4) Close the file
infoInputFileObj.close()

# including quotes to make it clear what is part of each string
# (i.e., is there a newline or not)

print('With newlines:')
print('Name: "' + nameLine + '"')
print('Fact: "' + amazingLine + '"')
print('Empty line: "' + emptyLine + '"')
print()

nameLine = nameLine.rstrip()
amazingLine = amazingLine.rstrip()
emptyLine = emptyLine.rstrip()

print('After calls to the rstrip() method:')
print('Name: "' + nameLine + '"')
print('Fact: "' + amazingLine + '"')
print('Empty line: "' + emptyLine + '"')