Articles → Python → Import Selected Attributes Of A Module In PythonImport Selected Attributes Of A Module In PythonIn this article, we will import selected attributes of a module in python.Example In this example, we will import ‘pi’ attribute of math module. Consider the following examplefrom math import pi print(pi)The output of the above code isClick to EnlargeNow change the above codefrom math import pi print(tan(1))You will get following errorClick to EnlargeThe reason is we have imported only ‘pi’ attribute not ‘tan’.Posted By - Karan Gupta Posted On - Friday, April 19, 2019 Query/Feedback Your Email Id Subject Query/Feedback Characters remaining 250
from math import pi print(pi)
from math import pi print(tan(1))
Query/Feedback