Answers for "python try open"

0

try catch python with open

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
Posted by: Guest on May-15-2020
0

error handling in python

try:
  print(x)
except SyntaxError:
  print("There is a SyntaxError in your code")
except NameError:
  print("There is a NameError in your code")
except TypeError:
  print("There is a TypeError in your code")
Posted by: Guest on September-08-2020

Python Answers by Framework

Browse Popular Code Answers by Language