get text off the net, then compare it with a previously retrieved text file. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

get text off the net, then compare it with a previously retrieved text file.

I am trying to get a listing off the net (currently a web page) and compare it with another list, and write the changes to yet another file. I would like to do this through python. I know that it can be done, just how, I am a bit foggy on... OK then, completely blind. any help would be so appreciated. thanks I n advance .

1st Aug 2016, 1:00 PM
James 'the bunyip' Ringhof
James 'the bunyip' Ringhof - avatar
2 Answers
+ 1
simple way to read content of the web page: import urllib.request with urllib.request.urlopen("http://mlacu.ga") as url: print(url.read()) more about how this works here https://docs.python.org/3/howto/urllib2.html . after you fetch the content you will need to parse it. this can be done with regular expressions if the structure of the web page is not too complicated or you will need some more sophisticated parser. note that the example above will not work in code playground (you will get "Memory limit exceeded" error when trying to import urllib.request).
1st Aug 2016, 2:04 PM
RedAnt
RedAnt - avatar
+ 1
Thanks heaps REDANT. I appreciate you taking the time out to help fellow brother python. Thank you so much. Any other help, from my brothers in arms, would still help. The more the merrier. The Bunyip
1st Aug 2016, 11:21 PM
James 'the bunyip' Ringhof
James 'the bunyip' Ringhof - avatar