WORKING WITH LISTS AND THE SPLIT() FUNCTION
You can use the split() function to split the words in a text string and populate a list with those words. An example is here:
>>> x = "this is a string"
>>> list = x.split()
>>> list
['this', 'is', 'a', 'string']
A simple way to print the list of words in a text string is as follows:
>>> x = "this is a string"
>>> for w in x.split():
... print w
...
this
is
a
string
You can also search for a word in a string:
>>> x = "this is a string"
>>> for w in x.split():
... if(w == 'this'):
... print "x contains this"
...
x contains this
...