pip用法:需要增加
导入模块
import random
from random import random
from random import *
打印传参

打印操作系统相关

自定义模块

from .module1 import *
name

python加载模块来自三个地方:
环境变量:PYTHONPATH
默认模块路径(包括当前目录)

多个文件组成一个包 init.py

导入所有包内成员

调用

import random
from random import random
from random import *
from .module1 import *
环境变量:PYTHONPATH
默认模块路径(包括当前目录)
本文标题:python3 模块和包
本文链接:https://www.haomeiwen.com/subject/rqsepctx.html
网友评论