MCPcopy Create free account
hub / github.com/LinkedInLearning/learning-python-2896241 / main

Function main

Ch5 - Internet Data/inetdata_finished.py:8–17  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

6import urllib.request # instead of urllib2 like in Python 2.7
7
8def main():
9 # open a connection to a URL using urllib2
10 webUrl = urllib.request.urlopen("http://www.google.com")
11
12 # get the result code and print it
13 print ("result code: ", webUrl.getcode())
14
15 # read the data from the URL and print it
16 data = webUrl.read()
17 print (data)
18
19if __name__ == "__main__":
20 main()

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected