how to get the code of a website in python 1

how to get the code of a website in python

def code_of_site(url):
    weburl = urllib.request.urlopen(url)
    code = weburl.read()
    return code
print(code_of_site("https://www.codegrepper.com/app/index.php"))

Here is what the above code is Doing:
1. We are importing the urllib.request module.
2. We are defining a function called code_of_site.
3. We are opening the url and reading the code.
4. We are returning the code.
5. We are printing the code.

Similar Posts