Untitled

 avatar
unknown
plain_text
2 years ago
474 B
5
Indexable
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)
Editor is loading...