How to split the words from multiple sentences?

I am working on a Sentiment Analysis problem, and there is a weird problem, that we have to set a fixed sequence_length of the input sentence in training. If the input sentence is greater than the sequence_length then we have to truncate the sentence an if small, then we have to pad it with zeros. Now I have a strategy, that after splitting all the sentences, we can count the max_length of a sentence and then set it the sequence_length. But when counting the length of every sentence, there is a problem, please check the code -

reviews_split = all_text.split('\n')
print(reviews_split[0])
output:  bromwell high is a cartoon comedy  it ran at the same time as some other programs about school life  such as  teachers   my   years in the teaching profession lead me to believe that bromwell high  s satire is much closer to reality than is  teachers   the scramble to survive financially  the insightful students who can see right through their pathetic teachers  pomp  the pettiness of the whole situation  all remind me of the schools i knew and their students  when i saw the episode in which a student repeatedly tried to burn down the school  i immediately recalled          at           high  a classic line inspector i  m here to sack one of your teachers  student welcome to bromwell high  i expect that many adults of my age think that bromwell high is far fetched  what a pity that it isn  t   

Next, I am using a loop to split the words of the sentences and count the number of words, but giving me the following error -

for i in reviews_split:
  #print(i)
  words = i.split()
  #word_split = words[i].split()
  #max_seq = 0
  print(len(words[i]))
print("Number of Reviews: ", len(reviews_split))
TypeError                                 Traceback (most recent call last)
<ipython-input-36-28f46af4c30b> in <module>()
      6   #word_split = words[i].split()
      7   #max_seq = 0
----> 8   print(len(words[i]))
      9 print("Number of Reviews: ", len(reviews_split))

TypeError: list indices must be integers or slices, not str

Can anyone please help how can I make it count the words in each and every sentence? Thanks in advance.

As far as counting the number of sentences and counting the words in each sentence is concerned, you can use the Natural Language Toolkit(NLTK) and it’s tokenize module. It provides functions to obtain each sentence and each word in a sentence.