python - Are these statements equivalent?: import package vs from package import * -


this question has answer here:

are these statements equivalent?:

import math , from math import *

import math means have put math (name of module) before use it, e.g. print(math.pi).

with using from math import *, python loading functions , variables math (or specified in __all__ exact) local namespace , can use them without module name prefix: print(pi).

hope helps!


Comments

Popular posts from this blog

php - Passing multiple values in a url using checkbox -

compilation - PHP install fails on Ubuntu 14 (make: *** [sapi/cli/php] Error 1) PHP 5.6.20 -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -