Created
January 25, 2019 05:43
-
-
Save ayuLiao/ffd0470fab7ee8b8967bbccf69ebc6ff to your computer and use it in GitHub Desktop.
python在导入数据时,使用当前python文件路径加上相对于当前文件的路径是比较好的方案
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| realpath = os.path.realpath(__file__) # 当前py文件路径 | |
| current_path = os.path.dirname(realpath) # 当前py所在的文件夹 | |
| globalconf = current_path+'/config/global.json' | |
| with open(globalconf, 'r') as f: | |
| pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment