lazysang
import sys,os

sys.path.append(os.getcwd())
#将当前工作目录加入path
#sys.path.append:添加环境变量
#os.getcwd:返回当前工作目录(注意是工作目录cwd哦)
import sys,os

sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
#将当前文件的上级目录添加到path
#sys.path.append:添加环境变量
#os.path.dirname:返回路径名的目录部门(可以获取多次)
#os.path.abspath:获取文件绝对路径  os.path.abspath(__file__) 直接写成__file__也可以

分类:

技术点:

相关文章:

  • 2021-12-14
  • 2022-12-23
  • 2021-12-14
  • 2021-12-14
  • 2021-09-10
  • 2021-11-28
  • 2022-01-01
  • 2022-12-23
猜你喜欢
  • 2021-09-09
  • 2021-08-20
  • 2021-08-16
  • 2021-08-13
  • 2021-12-04
相关资源
相似解决方案