New to Python.

droog droog at
Thu Mar 18 04:07:05 CET 2004

I was looking for the simpliest way of doing it. This is what I tried
to do. 

f = open('C:\Python23\Samples\Bob.txt', 'r')
counter = 0
while True:
	line = f.readline()
	if len(line) == 0:
	if line.find('customer'):
		counter = counter + 1
		print 'Found it ' + str(counter)


On Thu, 18 Mar 2004 02:53:48 GMT, droog <droog at> wrote:

>I have just started learning python and encountered a problem.
>All I wanted to do, was to open a text file search and count the
>number of occurances of a single word and print that count.
>Thanks for help.

More information about the Python-list mailing list