def write_file(fpath, content, newline=None): if overwrite or not path.isfile(fpath): print 'Creating file %s.' % fpath f = open(fpath, 'wt', encoding='utf-8', newline=newline) try: f.write(content) finally: f.close() else: print 'File %s already exists, skipping.' % fpath
def write_file(fpath, content, newline=None): if overwrite or not path.isfile(fpath): print "Creating file %s." % fpath f = open(fpath, "wt", encoding="utf-8", newline=newline) try: f.write(content) finally: f.close() else: print "File %s already exists, skipping." % fpath