Python——模块和主函数调用

python_module.py

#Demo 1: revoke the default function called pow
# print(pow(3, 3))

#Demo 2: revoke the function pow in math
# from math import pow
# print(pow(3, 3))

#Demo 3: revoke the self defined function of pow
import sys
sys.path.append('./common')
from my_math import pow
print(pow(3, 3))

my_math.py

def pow(a, b) :
	print('self defined power function revoked.')
	return a**b

if __name__ == '__main__' :
	print('self defined power function revoked end.')

你可能感兴趣的:(Python,python,开发语言,后端)