📜  文件和异常不起作用 python 代码示例

📅  最后修改于: 2022-03-11 14:45:27.761000             🧑  作者: Mango

代码示例1
try:
    f = open(fname, 'rb')
except OSError:
    print "Could not open/read file:", fname
    sys.exit()

with f:
    reader = csv.reader(f)
    for row in reader:
        pass #do stuff here