import sys
filename = 'info.txt'
mode = 'r'
try:
infoInputFileObj = open( filename, mode )
nameLine = infoInputFileObj.readline()
amazingLine = infoInputFileObj.readline()
emptyLine = infoInputFileObj.readline()
except:
print('ERROR! Unable to open or read from', filename)
sys.exit()
infoInputFileObj.close()
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 + '"')