try except

来源:互联网 发布:sql外键约束语句 编辑:程序博客网 时间:2024/06/05 22:44
'''Created on 2011-9-29@author: xgzhao'''#try-excepttry:    f = open('unicode.txt', 'r')except IOError, e:    print 'Could not open file: ', e    #with statement means  with open('unicode.txt', 'r') as f:    for eachline in f:        print eachline            

原创粉丝点击