标签:odi adl read 读取文件 ror 文件的 one imp for
#/usr/bin/env python #-*-coding:UTF-8-*- import sys """读取文件的常用方法""" def methodone(): fd = open("/home/userhome/hejoy/20170124.txt") try: for line in fd.readlines(): print line except IOError: print e finally: fd.close() def methodtwo(): try: for line in open("/home/userhome/hejoy/20170124.txt"): print line except IOError: print e def main(): methodtwo() if __name__==‘__main__‘: main()
标签:odi adl read 读取文件 ror 文件的 one imp for
原文地址:http://www.cnblogs.com/st12345/p/6692875.html