To call our pv_f()
function included in the Python program test01.py
, we can use import test01
or from test01 import *
. Obviously, it is more convenient to use pv_f()
instead of test01.pv_f()
. To call the function directly, we use from test01 import *
. Refer to the following parallel structures:
>>>from math import * >>>sqrt(3.5) 1.8708286933869707 >>>from test01 import * >>>pv_f(100,0.1,2) 82.64462809917354
When we are sure about the existence of a specific function in test01.py
, we can import it specifically as follows:
>>>from math import ceil,sqrt,pi >>>from test01 import pv_f
The del()
built-in function is used to remove a function or variable, as shown in the following code:
>>>del pv_f >>>dir() ['__builtins__', '__doc__', '__loader__', '__name__', '__package__']