Peter Otten wrote:

>>>> def mid(s, n):
> ...     shave = len(s) - n
> ...     if shave > 0:
              shave += len(s) % 2
> ...         shave //= 2
> ...         s = s[shave:shave+n]
> ...     return s

> Not exactly the same results as your implementation though.

The extra line should fix that, but it looks, err -- odd.

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

Reply via email to