天天看點

[Language]Python中錯誤與異常

簡述

try:
    filename = raw_input('Enter file name: ')
    fobj = open(filename, 'r')
    for eachLine in fobj:
        print(eachLine)
    fobj.close()
except IOError:
    print("file open error")