New to Python.

droog droog at orange.gov
Wed Mar 17 22:09:44 EST 2004


Thanks for helping, and no this is not a homework assignment
I just like python and wanted to learn it on my own.
droog

On Thu, 18 Mar 2004 03:07:05 GMT, droog <droog at orange.gov> wrote:

>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:
>		break
>	if line.find('customer'):
>		counter = counter + 1
>		print 'Found it ' + str(counter)
>
> 
>
>On Thu, 18 Mar 2004 02:53:48 GMT, droog <droog at orange.gov> wrote:
>
>>
>>Hello!
>>
>>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