str2d.Str2D.char
- property Str2D.char: ndarray
Return the character data. Alternatively, you can access the ‘char’ field directly by using the ‘data’ attribute and the ‘char’ key.
Examples
Let’s create an instance of Str2D and assign it to the variable a.
from str2d import Str2D a = Str2D('a b c d\ne f g\nh i\nj')
We can access the ‘char’ field directly by using the ‘data’ attribute and the
a.data['char']
array([['a', ' ', 'b', ' ', 'c', ' ', 'd'], ['e', ' ', 'f', ' ', 'g', ' ', ' '], ['h', ' ', 'i', ' ', ' ', ' ', ' '], ['j', ' ', ' ', ' ', ' ', ' ', ' ']], dtype='<U1')
This property is a shortcut to the above.
a.char
array([['a', ' ', 'b', ' ', 'c', ' ', 'd'], ['e', ' ', 'f', ' ', 'g', ' ', ' '], ['h', ' ', 'i', ' ', ' ', ' ', ' '], ['j', ' ', ' ', ' ', ' ', ' ', ' ']], dtype='<U1')