code for lineterm class code example

Example: python html diff

from pprint import pprint   def transform_text(lines):  """ Code to transform the lines array """  """ e.g. strip blank white spaces, \n characters, empty lines, etc. """  """ Also, same file can have same line multiple times, """  """ so remove duplicate lines from the lines array before returning """     modified_lines = lines      return modified_lines   def main():     file1 = open("one.html", "r")      file2 = open("two.html", "r")      diff = open("diff.html", "w")           lines1 = file1.readlines()     lines2 = file2.readlines()          # pprint(lines1)     # pprint(lines2)     diff_lines = []        lines1 = transform_text(lines1)     lines2 = transform_text(lines2)       # check line by line, entries in lines1 array exists in line2 or not     for i in range(0, len(lines1)):         if lines1[i] not in line