Get the absolute path of the script you are running

I often forget it and check it again, so make a note.

path.py


import os
print os.path.abspath(os.path.dirname(__file__))

Recommended Posts

Get the absolute path of the script you are running
Get absolute path of running process
To get the path of the currently running python.exe
Find out the version of the language you are running
Get the script path in Python
[Python] Get the script execution directory with an absolute path
Check the type of the variable you are using
I want to get the path of the directory where the running file is stored.
Since there are many earthquakes, get the history of earthquakes
Get the return code of the Python script from bat
Script to get the expiration date of the SSL certificate
Get the number of digits
Maya | Get the workspace path
Get the number of PVs of Qiita articles you posted with API
Get the number of views of Qiita
Get the desktop path in Python
Get the attributes of an object
Get the first element of queryset
Display the absolute path on the Finder
Get the number of Youtube subscribers
Get the desktop path in Python
Get the file path using Pathlib
Learning record (4th day) #How to get the absolute path from the relative path
View the full path (absolute path) of a file in a directory in Linux Bash
Get the song name from the title of the video you tried to sing
Get the return value of an external shell script (ls) with python3
Script to change the description of fasta
Pass the path of the imported python module
Get the minutes of the Diet via API
Get the path to the systemd unit file
Check the path of the Python imported module
About the development environment you are using
The basics of running NoxPlayer in Python
Get the value of the middle layer of NN
Get the last day of the specified month
[Python] Get the character code of the file
Get the filename of a directory (glob)
[PowerShell] Get the reading of the character string
How to get the notebook name you are currently using in Google Colab
Python script to get a list of input examples for the AtCoder contest
Get the contents of git diff from python
The contents of the Python tutorial (Chapter 5) are itemized.
The contents of the Python tutorial (Chapter 4) are itemized.
[Python] Get / edit the scale label of the figure
The contents of the Python tutorial (Chapter 2) are itemized.
[Python] Get the main topics of Yahoo News
Get the caller of a function in Python
The contents of the Python tutorial (Chapter 8) are itemized.
The contents of the Python tutorial (Chapter 1) are itemized.
The contents of the Python tutorial (Chapter 10) are itemized.
[Python] Get the last updated date of the website
Enter into stdin of the running Docker container
Get only the address part of NIC (eth0)
The contents of the Python tutorial (Chapter 6) are itemized.
Change the resolution of Ubuntu running on VirtualBox
The contents of the Python tutorial (Chapter 3) are itemized.
[Python] Get the day of the week (English & Japanese)
Get the region where AWS Lambda is running
Get the update date of the Python memo file.