One more helpful hint to get this thing off to a hopefully good start. How do we read a simple text file in Python? Also, what can we do with the data after we read it?
# read a text file to a string and create a list of words
# use any text file you have ...
textf = open('xmas.txt', 'r')
str1 = textf.read()
textf.close()
print( "The text file as one string:" )
print( str1 )
# splits at the usual whitespaces
wordlist = str1.split(None)
print( "\nThe string as a list of words:" )
print( wordlist )
print( "\nThere are %d words in the list." % len(wordlist) )
Want more help about split()? At the interactive page >>> prompt enter
help("string.split")
Last edited by vegaseat; Aug 16th, 2009 at 10:14 pm. Reason: [code=python], Python3 update
May 'the Google' be with you!