Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
613 B
3
Indexable
Never
import sys

filename = sys.argv[1]  # Just pass the instance number, it will overwrite the file.
filename = 'QC_N6_' + filename + '.qasm'  

# Open the file for reading
with open(filename, 'r') as file:
    lines = file.readlines()

# Define the search string and replacement string

search_string = "rz(-dt*"
replacement_string = "rz(-0.05*"

# Iterate through the lines and replace the search string
for i in range(len(lines)):
    lines[i] = lines[i].replace(search_string, replacement_string)

# Open the file for writing and overwrite its contents
with open(filename, 'w') as file:
    file.writelines(lines)