1

Let's say I have a numpy array a = numpy.array([1,2,3,4]). Now str(a) will give me "[1 2 3 4]". How do I convert the string "[1 2 3 4]" back to a numpy.array([1,2,3,4])?

cyber_tooth
  • 133
  • 2
  • 9

1 Answers1

2

Try numpy.array([int(v) for v in your_str[1:-1].split()])

Akami
  • 189
  • 8