使用os.path.realpath(__file__) 获得当前的文件夹的路径名, 使用os.path.split 进行路径切割
import os src, _= os.path.split(os.path.realpath(__file__)) print(src, _)
算法效果