On Fri, Apr 10, 2009 at 1:12 PM, Sander Sweers <[email protected]> wrote:
> results = []
>
> for line in text_file:
>    if 'FULLNAME' in line and line not in results:
>        results.append(line)
>        write_file.write(line)

In general it is better to use a set for this kind of application, it
will have much better performance if the number of lines is large.

results = set()
...
  results.add(line)

Kent
_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to