Untitled
Anonymous
plain_text
09/14/2023 4:54 PM
820 B
20
Indexable
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)Editor is loading...