File Read and Display : Text file : File PYTHON TUTORIALS


PYTHON TUTORIALS » File » Text file »

 

File Read and Display


#!/usr/bin/env python

fname = raw_input('Enter filename: ')
print

try:
    fobj = open(fname, 'r')
except IOError, e:
    print "*** file open error:", e
else:
    for eachLine in fobj:
        print eachLine,
    fobj.close()



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON TUTORIALS

 Navioo File
» Text file