1 Jan 01:35
Re: Empty strings not empty?
Christopher Barker <Chris.Barker <at> noaa.gov>
2010-01-01 00:35:23 GMT
2010-01-01 00:35:23 GMT
Matthew Brett wrote:
> I think the summary here is 'numpy strings are zero padded; therefore
> you may run into surprises with a string that has trailing zeros'.
>
> I see why that is - the zero terminator is the only way for numpy
> arrays to see where the end of the string is...
almost -- it's not quite zero-terminated, you can have embedded zeros:
In [35]: np.array('aa\x00bb', dtype='S6')
Out[35]:
array('aa\x00bb',
dtype='|S6')
-Chris
--
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker <at> noaa.gov
RSS Feed