发布时间:2019-09-09 08:46:32编辑:auto阅读(2071)
创建步骤:
创建一个文件夹:mymath,在该文件夹下创建三个python 文件,分别为:__init__.py getMax.py getMin.py
__init__.py: 这个文件必须以__init__命名,包管理器会自动寻找这个文件
__author__ = 'bloodchilde'
__all__=["getMax","getMin"]
__author__ = 'bloodchilde'
def max(a,b):
if a >= b:
return a
else:
return b
__author__ = 'bloodchilde'
def min(a,b):
if a <= b:
return a
else:
return b
test.py:
from mymath import getMax
from mymath import getMin
print getMax.max(1,2)
print getMin.min(1,2)
如下图所示:
上一篇: 强悍的 Python —— 读取大文件
下一篇: python 3d图
50993
50376
40991
37858
32323
29215
28097
22927
22896
21223
1088°
1779°
1450°
1387°
1661°
1471°
2128°
3686°
3623°
2545°