Created
May 1, 2020 23:29
-
-
Save barca/6e9044ceb717b53f7839cc7c61dfab3f to your computer and use it in GitHub Desktop.
I assume you use python3.7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib.request | |
with urllib.request.urlopen('http://python.org/') as response: | |
html = response.read() | |
with open("stored.html", "r+") as file: | |
if not (str(file.read()) == str(html)): | |
print("THIS IS WHERE YOU ALERT") | |
file.seek(0) #sets file pointer to beginning | |
file.truncate() #empties the file | |
file.write(str(html)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment