Untitled

mail@pastecode.io avatarunknown
plain_text
a month ago
380 B
1
Indexable
Never
 try:
        line_count=0
        with open(vm_log_filename, 'r') as input_file, open(filename, 'w') as output_file:
            # Using itertools.islice to copy lines between start and end indexes
            output_file.writelines(itertools.islice(input_file, X - 1, Y))
            line_count+=1
        print("Number of lines written to the output file:", line_count)