文件讀取和顯示 readtextfile.py

#/usr/bin/env python
#-*- coding: UTF-8 -*-
filename = raw_input('Enter filename:')
print    # 打印空行
#attempt to open file for reading
try:
    fobj = open(filename,'r')
except IOError,e:
    print '*** file open error:',e
else:
        for eachline in fobj:
            print eachline
        fobj.close()python

相關文章
相關標籤/搜索