MM Origin & Beyond Development : MMpy.filetools.Writer

Syntax

MMpy.filetools.Writer(file)

Description

Provide a simplified method to write to a data file.

Parameters

Name
Type
Description

file

MMpy.File

An open data file.

See Also

MMpy.filetools.read_all()

MMpy.filetools.write_all()

MMpy.filetools.RowReader

Examples

import MMpy from MMpy.filetools import ContextManager, RowReader, Writer # Create the file we'll write to proj_path = MMpy.Project().path() MMpy.File.copy(proj_path + 'source_file.DAT', proj_path + 'dest_file.DAT') # Iterate over the source, process data, and write changes to the destination. with ContextManager('dest_file.DAT') as dest: writer = Writer(dest) with ContextManager('source_file.DAT') as src: for row in RowReader(src): # process row data writer.write_row(row)

Resource ID

IDPH_FILETOOLS_WRITER