import os
here = os.path.dirname(os.path.abspath(__file__))
参考:
https://stackoverflow.com/questions/21957131/python-not-finding-file-in-the-same-directory
https://stackoverflow.com/questions/1315390/python-find-a-file-in-the-same-directory
import os
here = os.path.dirname(os.path.abspath(__file__))
参考:
https://stackoverflow.com/questions/21957131/python-not-finding-file-in-the-same-directory
https://stackoverflow.com/questions/1315390/python-find-a-file-in-the-same-directory
if we use pathlib, then
Path(__file__)