📜  try catch python with open - Python 代码示例

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

代码示例2
import os ,csv
# Created to ensure file/dataset are being load properly
# Place below your filename with .csv where 'x' is .
data = open('x', 'r')
while True:
  try:
      if data == open('x'):
          print('file is open')
  except IOError:
    print('Unable to load files')
    break