If you are running a script in the folder a, I would like to get the absolute path of c.py in the folder b in the same hierarchy as a in that script.
For example, a and b are in the same folder named d.python
It's solved.We actually used os.path.dirname to specify the upper hierarchy.
_init__.py must be placed in order to
import anything below the b folder.
_init__.py should be empty.
You can specify where this file is located in
By the way, the
import method can also be
However, if you import it that way, it must be
b.c.something() when calling the method.
Class definitions can also be invoked.
Check the documentation for details.
© 2022 OneMinuteCode. All rights reserved.