文件名称:python核心编程源码
文件大小:154KB
文件格式:RAR
更新时间:2012-06-15 09:42:19
python核心编程源码
python核心编程第二版的源码 #!/usr/bin/env python 'readTextFile.py -- read and display text file' # get filename fname = raw_input('Enter file name: ') print # attempt to open file for reading try: fobj = open(fname, 'r') except IOError, e: print"*** file open error:", e else: # display contents to the screen for eachLine in fobj: print eachLine, fobj.close()