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

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -