Split string > list of sublists of words and characters
<p>No imports allowed (it's a school assignment).</p>

<p>Wish to split a random string into a list of sublists. Words in a sublist, all other characters (including whitespace) would be in a sublist containing only one item. Anyone have some advice on how to do this;</p>

<pre><code>part = "Hi! Goodmorning, I'm fine."
list = [[H,i],[!],[_],[G,o,o,d,m,o,r,n,i,n,g],[,],[_],[I],['],[m],[_],[f,i,n,e],[.]]
</code></pre>

<pre><code>part = "Hi! Goodmorning, I'm fine."
a = []
b = []
c = 0
for i in part:
    if i.isalpha():
        if c == 1:
            a.append(b)
            b=[]
            b.append(i)
            c = 0
        else:
            b.append(i)
    else:
        a.append(b)
        b=[]
        b.append(i)
        c = 1
a.append(b)
print a
</code></pre>

python python-2.7