def write_file(self):
        f_oc = open(self.fn_path, 'w')
        f_oc.write('{}\n'.format(self.heading))

        # write options

        f_oc.write('HEAD PRINT FORMAT {0:3.0f}\n'\
                   .format(self.ihedfm))            
        if self.chedfm is not None:
            f_oc.write('HEAD SAVE FORMAT {0:20s} LABEL\n'\
                       .format(self.chedfm))            
        f_oc.write('HEAD SAVE UNIT {0:5.0f}\n'\
                   .format(self.unit_number[1]))            
            
        f_oc.write('DRAWDOWN PRINT FORMAT {0:3.0f}\n'\
                   .format(self.iddnfm))
        if self.cddnfm is not None:
            f_oc.write('DRAWDOWN SAVE FORMAT {0:20s} LABEL\n'\
                       .format(self.cddnfm))
        f_oc.write('DRAWDOWN SAVE UNIT {0:5.0f}\n'\
                   .format(self.unit_number[2]))

        if self.ibouun > 0:
            if self.cboufm is not None:
                f_oc.write('IBOUND SAVE FORMAT {0:20s} LABEL\n'\
                            .format(self.cboufm))
            f_oc.write('IBOUND SAVE UNIT {0:5.0f}\n'\
                       .format(self.unit_number[4]))

        if self.compact:
            f_oc.write('COMPACT BUDGET AUX\n')
        
        # add a line separator between header and stress
        #  period data
        f_oc.write('\n')


        #write the transient sequence described by the data dict
        nr, nc, nl, nper = self.parent.get_nrow_ncol_nlay_nper()
        nstp = self.parent.get_package('DIS').nstp

        keys = list(self.stress_period_data.keys())
        keys.sort()

        data = []
        lines = ''
        ddnref = ''
        for kper in range(nper):
            for kstp in range(nstp[kper]):
                kperkstp = (kper, kstp)
                if kperkstp in keys:
                    data = self.stress_period_data[kperkstp]
                    if not isinstance(data, list):
                        data = [data]
                    lines = ''
                    if len(data) > 0:
                        for item in data:
                            if 'DDREFERENCE' in item.upper():
                                ddnref = item.lower()
                            else:
                                lines += '{}\n'.format(item)
                if len(lines) > 0:
                    f_oc.write('period {} step {} {}\n'.format(kper+1, kstp+1, ddnref))
                    f_oc.write(lines)
                    f_oc.write('\n')
                    ddnref = ''

        # close oc file
        f_oc.close()
Insert text into the command line.
dataset/ETHPy150Open modflowpy/flopy/flopy/modflow/mfoc.py/ModflowOc.write_file--crossover with--dataset/ETHPy150Open deanhiller/databus/webapp/play1.3.x/python/Lib/site-packages/pyreadline/rlmain.py/Readline.insert_text