Read printed numpy array
You can use re
to treat the string and then create the array using eval()
:
import re
from ast import literal_eval
import numpy as np
a = """[[[ 0 1]
[ 2 3]]]"""
a = re.sub(r"([^[])\s+([^]])", r"\1, \2", a)
a = np.array(literal_eval(a))