如何使用Python在多个文件夹中导入不同模块?
- 内容介绍
- 文章标签
- 相关推荐
本文共计106个文字,预计阅读时间需要1分钟。
pythonimport os.path as ospimport sys
def add_path(path): if path not in sys.path: sys.path.insert(0, path)this_dir=osp.dirname(__file__)path1=osp.join(this_dir, 'DATA')add_path(path1)黄世宇/Shiyu Huang的个人页面:h
import sys
def add_path(path):
if path not in sys.path:
sys.path.insert(0, path)
this_dir = osp.dirname(__file__)
path1 = osp.join(this_dir, '..', 'DATA')
add_path(path1)
黄世宇/Shiyu Huang's Personal Page:huangshiyu13.github.io/
本文共计106个文字,预计阅读时间需要1分钟。
pythonimport os.path as ospimport sys
def add_path(path): if path not in sys.path: sys.path.insert(0, path)this_dir=osp.dirname(__file__)path1=osp.join(this_dir, 'DATA')add_path(path1)黄世宇/Shiyu Huang的个人页面:h
import sys
def add_path(path):
if path not in sys.path:
sys.path.insert(0, path)
this_dir = osp.dirname(__file__)
path1 = osp.join(this_dir, '..', 'DATA')
add_path(path1)
黄世宇/Shiyu Huang's Personal Page:huangshiyu13.github.io/

