Hi

I have a fileobject which was fine however now I want to delete a line from the 
file object before yielding.

def return_files(file_list):
    for filename in sorted(file_list):
        with open(dir_path + filename) as fd:
             for fileItem in fd:
                 yield fileItem

Ned gave an answer over here http://stackoverflow.com/a/6985814/461887

for i, line in enumerate(input_file):
    if i == 0 or not line.startswith('#'):
        output.write(line)

which I would change because it is the first line and I want to rid <!--

for i, line in enumerate(input_file):
    if line.startswith(<!--'):
        output.write(line)

However I do not want to write the file I want to restore all the enumerated 
files back to the fileItem I need to yield.

How do I do this?

Cheers

Sayth
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to