diff --git a/src/qiskit_qec/circuits/repetition_code.py b/src/qiskit_qec/circuits/repetition_code.py index b08ccda4..b8500d23 100644 --- a/src/qiskit_qec/circuits/repetition_code.py +++ b/src/qiskit_qec/circuits/repetition_code.py @@ -349,7 +349,7 @@ def string2raw_logicals(self, string): Returns: list: Raw values for logical operators that correspond to nodes. """ - return string.split(' ')[0][-1] + return string.split(" ", maxsplit=1)[0][-1] def check_nodes(self, nodes, ignore_extra_boundary=False, minimal=False): """ diff --git a/test/code_circuits/test_rep_codes.py b/test/code_circuits/test_rep_codes.py index 3b3202e2..7a76430c 100644 --- a/test/code_circuits/test_rep_codes.py +++ b/test/code_circuits/test_rep_codes.py @@ -555,7 +555,7 @@ def clustering_decoder_test( for j, z_logical in enumerate(decoder.measured_logicals): error = corrected_z_logicals[j] != 1 if error: - error_num = string.split(" ")[0].count("0") + error_num = string.split(" ", maxsplit=1)[0].count("0") if error_num < min_error_num: min_error_num = error_num min_error_string = string