Listing 7. Opening a Write File

#! /usr/local/bin/python
import os
import sys
try:
        fi = open('sample_+_file', 'w')
except IOError:
        print 'Can\'t open file for writing.'
        sys.exit(0)