Checking for binary data in a string
Grant Edwards
grante at visi.com
Sat Jun 20 10:44:38 EDT 2009
On 2009-06-19, Lie Ryan <lie.1296 at gmail.com> wrote:
> Grant Edwards wrote:
>> On 2009-06-19, Mitko Haralanov <mitko at qlogic.com> wrote:
>>
>>> I have a question about finding out whether a string contains
>>> binary data?
>>
>> All strings contain binary data.
>
> Not quite, (python 2.x's) strings are binary data.
>
> It just happens that it behaves like text when you appropriately
> encode/decode it.
>
> In python 3.x, the default string have evolved to unicode
> string, which is a true text and the old string which contains
> arbitrary binary data evolved into bytestring.
You've got a computer that stores unicode strings as something
other than binary data? ;)
--
Grant
More information about the Python-list
mailing list