diff --git a/graphix/pattern.py b/graphix/pattern.py index d045582c..13a6734b 100644 --- a/graphix/pattern.py +++ b/graphix/pattern.py @@ -1525,7 +1525,7 @@ def to_qasm3(self, filename): filename : str file name to export to. example: "filename.qasm" """ - with Path(filename + ".qasm", "w").open(encoding="utf-8") as file: + with Path(filename).with_suffix(".qasm").open("w", encoding="utf-8") as file: file.write("// generated by graphix\n") file.write("OPENQASM 3;\n") file.write('include "stdgates.inc";\n')