Introduction To Python - Learn Python the hard way v2.0
Title: Exercise_15
#!usr/bin/python
from sys import argv
prompt = ('Enter y/Y for yes and n/N for no >>>')
print "Enter filename to be read"
filename = raw_input()
filehandle = open(filename, 'r')
print "file contents are :"
print filehandle.read()
print "Do you want to read this file again?"
ans = raw_input(prompt)
if ans == 'y' :
filehandle = open(filename, 'r')
print filehandle.read()
elif ans == 'Y' :
filehandle = open(filename, 'r')
print filehandle.read()
elif ans == 'n' :
print "Your answer is no"
elif ans == 'N' :
print "Your answer is no"
else :
print "You enter a wrong option"
filehandle.close()
