if I somehow can combine the multiple open calls with the with statement:
with open('a', 'w') as a and open('b', 'w') as b:
except IOError as e:
print 'Operation failed: %s' % e.strerror
If that's not possible, what other way to solve this problem look like?