manually splitting a string in python - issue with the last delimiter
<p>i wrote this:</p>

<pre><code>def split(line,delim):
    s=[]
    j=0
    for i in range (len(line)-1):
        if delim== line [i]:
            s.append(line[j:i])
            j=i+1
    s.append (line[j:])
    return s
</code></pre>

<p>but when i put a line and the end-letter is the delim it return also the delim
like this:</p>

<pre><code>split('bndghsjhskashakhs', 's')

['bndgh', 'jh', 'ka', 'hakhs']
</code></pre>
