Question about struct.unpack
Scott David Daniels
scott.daniels at acm.org
Wed Feb 22 17:10:02 EST 2006
Eric Jacoboni wrote:
> But :
>> nom = nomz.rstrip('\0')
>
> doesn't work for me:
>
>>>> nomz
> 'Dupont\x00\x80\xbf\xff\xf70\x8f\xe0u\xa4\x00\x00.8\xfe\xfe\xfe\xff\x80\x80\x80\x80'
>
>>>> nom = nomz.rstrip('\0')
>>>> nom
> 'Dupont\x00\x80\xbf\xff\xf70\x8f\xe0u\xa4\x00\x00.8\xfe\xfe\xfe\xff\x80\x80\x80\x80'
Sorry, I thought you had NUL-filled data.
For NUL terminated data:
nom = nomz[: nomz.index('\0')]
--Scott David Daniels
scott.daniels at acm.org
More information about the Python-list
mailing list