--- lang: ja-jp breaks: true --- # Python スクリプトの絶対パスを取得 2021-07-23 ```python= import os scriptPath = os.path.dirname(os.path.abspath(__file__)) print('script path: ', scriptPath) ``` :::info パスの末尾に区切り文字はありません。 ::: :::warning `os.getcwd()`では正しく取得できません。 ::: ###### tags: `Python` `スクリプト` `絶対パス`
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up