On Fri, Apr 10, 2009 at 12:04 PM, Spencer Parker <[email protected]> wrote:
>
> This is my code:
> http://pastebin.com/m11053edf
I guess you have something like this now:
for line in text_file.readlines():
if line.find('FULLNAME')>=0:
write_file.writelines(line)
This can be better written as
for line in text_file: # No need for readlines(), a file is iterable
if 'FULLNAME' in line:
write_file.write(line) # writelines() is for writing multiple lines at once
Kent
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor