#!/usr/bin/python3 import struct ############################################################################### # Concatenate continuation lines in a file, yielding concatenated lines on # successive calls def continuation_lines( fh ): for line in fh: line = line.rstrip( '\n' ) while line.endswith( '\\' ): line = line[:-1] + next( fh ).rstrip( '\n' ) yield line