绝对路径:
PROJECT_ROOT = os.path.dirname(os.path.realpath(__file__))#获取项目根目录path = os.path.join(PROJECT_ROOT,"data\\edge\\0_fuse.txt") #文件路径edgeMap = np.loadtxt(path)
相对路径:
path = "./data/edge/98_fuse.txt" # 文件路径edgeMap = np.loadtxt(path)
应用:
读取文件操作:
https://www.cnblogs.com/xyf9575/p/7039548.html