Making a list containing string sentences a 2 dimensional list
<p>In python 3, I have a list where each element of this list is a sentence string, for example</p>

<pre><code>list = ["the dog ate a bone", "the cat is fat"] 
</code></pre>

<p>How do I split each sentence string into an individual list while keeping everything in the individual list, making it a 2 dimensional list </p>

<p>For example...</p>

<pre><code>list_2 = [["the", "dog", "ate", "a", "bone"], ["the", "cat", "is", "cat"]]
</code></pre>

<p>You can simply do the following.Use split() method on each of the value and reassign the value of every index with new comma seperated text</p>

<pre><code>mylist=['the dog ate a bone', 'the cat is fat']
print(mylist)

def make_two_dimensional(list):

    counter=0
    for value in list:
        list[counter]= value.split(' ')
        counter += 1

make_two_dimensional(mylist)
print(mylist)
</code></pre>

python list dimensional