hexrec.records.save_records#
- hexrec.records.save_records(path, records, output_type=None, split_args=None, split_kwargs=None, build_args=None, build_kwargs=None)[source]#
Saves records to a record file.
- Parameters:
path (str) – Path of the output file.
records (list of records) – Sequence of records to save.
output_type (type) – Output record type. If
None
, it is guessed from the file extension.split_args (list) – Positional arguments for
Record.split()
.split_kwargs (dict) – Keyword arguments for
Record.split()
.build_args (list) – Positional arguments for
Record.build_standalone()
.build_kwargs (dict) – Keyword arguments for
Record.build_standalone()
.
Example
>>> from hexrec.formats.intel import Record as IntelRecord >>> records = list(IntelRecord.split(bytes(range(256)))) >>> save_records('bytes.hex', records) >>> load_records('bytes.hex') == records True