abspathがファイルの絶対パス。
import os current_path = os.path.abspath(__file__) exec_path = current_path.replace('/python/post.py', '') path = "{}/config/hoge.txt".format(exec_path) print(path)
なるほど、パスの取得は色々あって便利やね。
ソフトウェアエンジニアの技術ブログ:Software engineer tech blog
随机应变 ABCD: Always Be Coding and … : хороший