Mega Code Archive

 
Categories / Python Tutorial / Statement
 

Try-finally Statement

try:     try:          ccfile = open('data.txt', 'r')          txns = ccfile.readlines()     except IOError:         log.write('no txns this month\n') finally:         ccfile.close()