让python代码找到文件路径的最好方法
也就是算出绝对路径传进去.
import os
wenjian='/'.join(os.path.abspath(__file__).split('/')[:-2])+'/'
with open(wenjian+"meddata.json", "r") as f:
med_data=json.load(f)
contact me:wechat 15122306087
也就是算出绝对路径传进去.
import os
wenjian='/'.join(os.path.abspath(__file__).split('/')[:-2])+'/'
with open(wenjian+"meddata.json", "r") as f:
med_data=json.load(f)