python global import

Solutions on MaxInterview for python global import by the best coders in the world

showing results for - "python global import"
Alberto
31 Jun 2016
1>>> math
2Traceback (most recent call last):
3  File "<stdin>", line 1, in <module>
4NameError: name 'math' is not defined
5>>> def f():
6...     global math
7...     import math
8...
9>>> f()
10>>> math
11<module 'math' from '/usr/local/lib/python2.6/lib-dynload/math.so'>