Home  >  Magazine  >  #73 May 2000  >  Python Programming for Beginners  >  Listing 7. Opening a Write File
Wednesday, March 29, 2000 | Last Updated 03:42:45 PM


  

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)