In <[EMAIL PROTECTED]>, John Machin
wrote:

> In other words, if the last byte of strg is NUL, throw it away.
> 
> The truly paranoid would code that as
>     if strg and strg[-1] etc etc
> so that it wouldn't blow up if strg is empty -- strange things can
> happen when you are reading other people's data :-)

I would spell it:

if strg.endswith('\0'):
    strg = strg[:-1]

Ciao,
        Marc 'BlackJack' Rintsch
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to