如何阅读/billy/var/text.txt
到b.py
目录结构是:
/billy/b.py
/billy/var/text.txt
/sally/s.py
s.py
import sys, os
sys.path.append('..')
from billy import b
print('s.py - ' + os.path.dirname(sys.argv[0]))
b.py
import sys, os
print('b.py - ' + os.path.dirname(sys.argv[0]))
ag = open(os.path.dirname(sys.argv[0]) + '//var//text.txt').read()