python 引用其他目录的文件

xiaoxiao2021-02-28  131

1.在Python中引用其他目录中的文件

import sys sys.path.append('complete_path') #正常import即可

2.引用当前目录下src/中的文件

import sys sys.path.append('./src')

3.引用上级目录中的文件

import sys sys.path.append('../')

4._init_.py方式 在这里

转载请注明原文地址: https://www.6miu.com/read-19146.html

最新回复(0)