Mac找不到文件位置
2023-11-05 本文已影响0人
kingloongMagic
# -*- coding: utf-8 -*-
# @Author: zhangfujie
# @Date: 2019-09-05 22:36:05
# @Last Modified by: zhangfujie
# @Last Modified time: 2019-09-07 22:36:58
import os, sys
# 获取路径
def getPath(fileName):
path = os.path.join(os.path.dirname(sys.argv[0]), fileName)
return path
# 这是我的配置文件的路径
obsLibConfigPath = getPath('ZFJObsLibConfig')
# 这是我词库的路径
lexiconPath = getPath('lexicon20.txt')
if __name__ == '__main__':
print(lexiconPath)