searching for matches within a word list
Scott David Daniels
Scott.Daniels at Acm.Org
Wed Jul 30 18:10:25 EDT 2003
Rajarshi Guha wrote:
> Hi,
> I have a large list of words (each on its own line)
> and I would like to find words that contain a specific string.
How bad is (for 2.3)?
result = []
apnd = result.append
source = file('data', 'U')
for line in source:
if specific in line:
apnd(line)
source.close()
# result is the list you want
-Scott David Daniels
Scott.Daniels at Acm.Org
More information about the Python-list
mailing list