import sys

# get hits from miranda scans
cap = ""
with open (sys.argv[1]) as infile1:
    for line1 in infile1:
        line1 = line1.strip()
        if "%" in line1 and "Forward:" not in line1:
            #print(line1)
            cap = cap + line1 + "\n"
allregnettf = open(sys.argv[2], "w")
allregnettf.write(cap)
allregnettf.close()

import sys

# get hits from miranda scans
with open(sys.argv[1]) as infile1:
    with open(sys.argv[2], "w") as outfile:
        for line1 in infile1:
            if "%" in line1 and "Forward:" not in line1:
                outfile.write(line1)

Write output on the file.
Write output on the file.

  import sys
  
  # get hits from miranda scans
- cap = ""
- with open (sys.argv[1]) as infile1:
+ with open(sys.argv[1]) as infile1:
+     with open(sys.argv[2], "w") as outfile:
-     for line1 in infile1:
+         for line1 in infile1:
-         line1 = line1.strip()
-         if "%" in line1 and "Forward:" not in line1:
+             if "%" in line1 and "Forward:" not in line1:
+                 outfile.write(line1)
-             #print(line1)
-             cap = cap + line1 + "\n"
- allregnettf = open(sys.argv[2], "w")
- allregnettf.write(cap)
- allregnettf.close()
  
Write output on the file.
## Code Before:
import sys

# get hits from miranda scans
cap = ""
with open (sys.argv[1]) as infile1:
    for line1 in infile1:
        line1 = line1.strip()
        if "%" in line1 and "Forward:" not in line1:
            #print(line1)
            cap = cap + line1 + "\n"
allregnettf = open(sys.argv[2], "w")
allregnettf.write(cap)
allregnettf.close()

## Instruction:
Write output on the file.
## Code After:
import sys

# get hits from miranda scans
with open(sys.argv[1]) as infile1:
    with open(sys.argv[2], "w") as outfile:
        for line1 in infile1:
            if "%" in line1 and "Forward:" not in line1:
                outfile.write(line1)
