qiskit.circuit.QuantumCircuit.qasm¶
-
QuantumCircuit.
qasm
(formatted=False, filename=None, encoding=None)[source]¶ Return OpenQASM string.
- Parameters
formatted (bool) – Return formatted Qasm string.
filename (str) – Save Qasm to file with name ‘filename’.
encoding (str) – Optionally specify the encoding to use for the output file if
filename
is specified. By default this is set to the system’s default encoding (ie whateverlocale.getpreferredencoding()
returns) and can be set to any valid codec or alias from stdlib’s codec module
- Returns
If formatted=False.
- Return type
str
- Raises
MissingOptionalLibraryError – If pygments is not installed and
formatted
isTrue
.QasmError – If circuit has free parameters.