python 设置文件路径

import os


def add_path(path):
    return os.path.join(os.path.dirname(__file__) + '/{}'.format(path))


class Path:
    """
    统一的路径指向
    """
    # pickle folder
    pkl_folder = add_path('../../../data/pkl/')
    json_folder = add_path('../../../data/json/')
    txt_folder = add_path('../../../data/txt/')

你可能感兴趣的:(python 设置文件路径)