Marc 'BlackJack' Rintsch wrote:

> I would spell it:
> 
> if strg.endswith('\0'):
>     strg = strg[:-1]

unless you're in a hurry; startswith and endswith are horribly 
inefficient compared to ordinary indexing/slicing.

(as I've pointed out elsewhere, even "s[:len(t)] == t" is usually faster 
than "s.startswith(t)" for short prefixes, where "short" is a lot longer 
than you may think).

</F>

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to