[Tutor] counting in a file

alan.gauld@bt.com alan.gauld@bt.com
Mon Nov 18 06:16:36 2002


> I'm trying to count the number of times a word occurs in a file. 
> Thanks in advance for any suggestions.

Try checking out the case study in my tutorial.
Also consider the xreadlines() function instead of readlines()

BTW, I assume you mean the string.split() function not the 
string.strip() function as used in your post?

Alan g.
Author of the 'Learning to Program' web site
http://www.freenetpages.co.uk/hp/alan.gauld