0
点赞
收藏
分享

微信扫一扫

Python导入不同文件夹下模块

青乌 2022-07-18 阅读 176

import os.path as osp
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:​​https://huangshiyu13.github.io/​​



举报

相关推荐

0 条评论