hey guys!

I am trying to learn a bit of python, and thought it would be a challenge to 
make a script that reads a text file and returns all the instances of a word I 
specify. Basically a find and then a list of all the finds.

I am using a text file with some random words in it to test it out on

Thanks!

Adam



My script so far is this:

---------------------------------

import fileinput

print
print "Welcome to LIST YOUR FILEINS script"

print
print "STEP 01"

print "drag'n'drop your script from the Finder here"
script = raw_input(">")

print
print "The location of your script is"
print script

print

file=open(script)
text=file.readlines()
f = 'file'
for f in text: print f

----------------------------------------

The test file:

random
words
file in
filein
mac
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to