As you start checking out code samples on the Web, you'll see some programmers use "from library import *". This will import all the functions in a library and then you don't have to use the name of the library in front of each call.
As an example, the code below uses just "import":
import urllib # Include the URL library TheService=urllib.request.urlopen('http://www.google.com/') # Open the URL
The code below does exactly the same thing but uses "from library import *":
from urllib import * # Include the URL library TheService=request.urlopen('http://www.google.com/') # Open the URL
Either method works but the second one does not require the "urllib" in front of each function call. You might want to use the "*" method all the time but the problem is that if you include two librarys that have the same function names, you will have a problem called a "name collision". You can use the "*" method but if you have a name collision, just go back to the regular import.
© Copyright 2018 HSU - All rights reserved.