title: 10 ,most frequent words in a string Python
body: <p>I need to display the 10 most frequent words in a text file, from the most frequent to the least as well as the number of times it has been used. I can't use the dictionary or counter function. So far I have this:</p>
  
  <pre><code>import urllib
  cnt = 0
  i=0
  txtFile = urllib.urlopen("http://textfiles.com/etext/FICTION/alice30.txt")
  uniques = []
  for line in txtFile:
      words = line.split()
      for word in words:
          if word not in uniques:
              uniques.append(word)
  for word in words:
      while i&lt;len(uniques):
          i+=1
          if word in uniques:
               cnt += 1
  print cnt
  </code></pre>
  
  <p>Now I think I should look for every word in the array 'uniques' and see how many times it is repeated in this file and then add that to another array that counts the instance of each word. But this is where I am stuck. I don't know how to proceed.</p>
  
  <p>Any help would be appreciated. Thank you</p>