hi guys im trying to make the words that have capital letters in small caps, then count the numbers of times a certain words appears in the text.
i managed to count the number of times a word appears but now im having trouble converting upperletters to caps on all words.
here is my code:
words = {}
file = open ('input.txt', 'r')
for line in file:
wordlist = line.split()
for word in wordlist:
[B] if words.upper(word):
words[word]=words.lower(word)[/B] [B]<<< not working for conversion but not sure if its correct[/B]
if words.has_key(word):
words[word]=words[word]+1
else:
words[word] = 1
for word in words:
print word, words[word]
thank you