diff - compare http pages Python -
i have gotten 2 http pages , want compare between them @ python. problem got files in different ways: in first page content divided blocks , in second content in 1 block.
is there elegant way compare between them?
hi solution read 2 files, after exclude blank lines, , prints common lines regardless of position in file
with open('your_file_1', 'r') file_1: open('your_file_2', 'r') file_2: same = set(file_1).intersection(file_2) same.discard('\n') # exclude blank lines open('output_file.txt', 'w') file_out: line in same: file_out.write(line)
Comments
Post a Comment