files and exceptions not working python code example
Example: files and exceptions not working python
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