# Count the number of words in a text file and # make a list of all the words in the file num_words = 0 big_word_list = [] silly_file = open("silly.txt", "r") for line in silly_file: #print line, word_list = line.split() #print word_list num_words += len(word_list) big_word_list.extend(word_list) silly_file.close() print "Total words in file: ", num_words print big_word_list