如何将python函数模块化?

Python (197) 2023-04-21 05:36:49

本文教程操作环境:windows7系统、Python 3.9.1,DELL G3电脑。

准备python模块化案例:

1、定义文件函数

defprint1():
print("print1()")

2、结果

3、编写语法

frommoduleNameimportfunctionName

4、案例生成

fromsupportimportprint1,print2
print1()

或者也可以简写成from moduleName import,进行函数模块化的导入,好啦,本章内容在上述也介绍完毕,大家抓紧学习起来吧。

《相关推荐:php框架》

THE END

发表回复