[SciPy-dev] Force trailing ws in chararray

David Goldsmith d_l_goldsmith at yahoo.com
Tue Aug 18 20:01:37 EDT 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