Answers for "python with and exceptions"

25

try except python

try:
  print("I will try to print this line of code")
except ERROR_NAME:
  print("I will print this line of code if error ERROR_NAME is encountered")
Posted by: Guest on February-01-2020
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

Python Answers by Framework

Browse Popular Code Answers by Language