I need to decode, with Python 3, a string that was encoded the following way:
>>> s = numpy.asarray(numpy.string_("hello\nworld"))
>>> s
array(b'hello\nworld', dtype='|S11')
I tried:
>>> str(s)
"b'hello\\nworld'">>> s.decode()
AttributeError Traceback (most recent call last)
<ipython-input-31-7f8dd6e0676b> in <module>()
----> 1 s.decode()AttributeError: 'numpy.ndarray' object has no attribute 'decode'>>> s[0].decode()
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-34-fae1dad6938f> in <module>()
----> 1 s[0].decode()IndexError: 0-d arrays can't be indexed