I have the following file in python that I'm reading in and I want to keep track if the line is = [FOR\_RECORD]. At that point I have a for loop populating an output with the value of [REG\_NAME], until I reach the [/FOR\_RECORD]. Then I want to go back to the start of the [FOR\_RECORD] portion of the file to start populating with the next [REG\_NAME]. How can I jump around in a python file like this?

Input file

```
--
--   generated with parser version 1.09
use ieee.std_logic_arith.all;

package [PKG_FILE]_pkg is

 [FOR_RECORD]
   constant [REG_NAME]_offset : std_logic_vector := x"[OFFSET]";
 [/FOR_RECORD]

 type [REG_NAME]_type is record
      [FILED_NAME]        : std_logic;               -- [OFFSET]     :
    end record [REG_NAME]_type;

 Package is [PKG_FILE]

```

Python code

```
for line in input_1:
    if '[FOR_RECORD]' in line:
        # This is where I want to jump to the next line
        #So I can evaluate the contents

    # I have 4 names in reg_name[i]
    #Very important that this is nested in the if statement
        for x in range(0,4):   
            if '[/FOR_RECORD]' in line:
                break
            if '[REG_NAME]' in line:
                line=line.replace('[REG_NAME]',reg_name[i]['name'])
                output.write(line)    

    output.write(line)

```