1def FileCheck(fn):
2 try:
3 open(fn, "r")
4 return 1
5 except IOError:
6 print "Error: File does not appear to exist."
7 return 0
8
9result = FileCheck("testfile")
10print result
1import os ,csv
2# Created to ensure file/dataset are being load properly
3# Place below your filename with .csv where 'x' is .
4data = open('x', 'r')
5while True:
6 try:
7 if data == open('x'):
8 print('file is open')
9 except IOError:
10 print('Unable to load files')
11 break