In the two following statements:
import base64
from base64 import *
since both would import the complete library yet we need to write base64.b64encode()
for first case (to call b64encode() function from base64 library) and using the same for second case, we get a
NameError: name 'base64' is not defined
.
For the second case b64encode()
is used to call the function.
If they import the library completely then what causes this difference.
NOTE: base64 library is used only as an example. EDIT: I was hoping for an explanation to why this happens and not which is better to use.