Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
474 B
1
Indexable
Never
import sys

infile = sys.argv[1]  
outfile = sys.argv[2] 

# Specify the QASM file path
qasm_file_path = infile

with open(outfile, 'w') as file:

# Open the QASM file for reading
    with open(qasm_file_path, 'r') as qasm_file:
        # Iterate through each line in the QASM file
        for line in qasm_file:
            # Check if the line contains a two-qubit gate (e.g., 'cx' or 'cz')
            if 'cx' in line or 'cz' in line:
                file.writelines(line)