If you do not specify anything in split (), it will create a list separated by spaces.
>>> s1 = "The quick brown fox jumps over the lazy dog."
>>> s_list = s1.split()
>>> print(s_list)
['The', 'quick', 'brown', 'fox', 'jumps', 'over', 'the', 'lazy', 'dog.']
>>> print(s_list[1])
quick
>>> len(s_list)
9
>>> while i < len(s_list):
print(s_list[i])
i += 1
The
quick
brown
fox
jumps
over
the
lazy
dog
>>> for w in s_list:
print(w)
The
quick
brown
fox
jumps
over
the
lazy
dog.
Recommended Posts