[SciPy-dev] Force trailing ws in chararray

David Goldsmith d_l_goldsmith@yahoo....
Tue Aug 18 19:01:37 CDT 2009


The np.array().view(np.chararray) way to create a chararray appears to automatically strip trailing whitespace:

>>> c=np.array(['aAaAaA','  aA  ','abBABba'],dtype='S7')
>>> c[1]; len(c[1])
'  aA  '
6
>>> c=c.view(np.chararray)
>>> c[1]; len(c[1])
'  aA'
4

Is there a way to suppress this behavior?  If not, bug or feature?

Thanks,

DG


      


More information about the Scipy-dev mailing list