Created
November 9, 2019 15:41
-
-
Save xaviergoby/d50a09a40338b2bd197489e3198fcfef to your computer and use it in GitHub Desktop.
Working with paths in Pyhton - Examples
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Running all lines of code in: | |
Windows path seperator: \ | |
OS X & Linux path sep: / | |
(On Windows)Shift + Right Click (on looped_data_loading.py)| Copy as Path:"C:\Users\XGOBY\LSTMforSHM\src\looped_data_loading.py" | |
>>>os.getcwd() | |
'C:\\Users\\XGOBY\\LSTMforSHM\\src' | |
>>>os.path.abspath(__file__) | |
'C:\\Users\\XGOBY\\LSTMforSHM\\src\\looped_data_loading.py' | |
>>>os.path.relpath(__file__) | |
'looped_data_loading.py' | |
>>>print(__file__) | |
C:/Users/XGOBY/LSTMforSHM/src/looped_data_loading.py | |
>>>os.path.join(os.getcwd(), __file__) | |
'C:/Users/XGOBY/LSTMforSHM/src/looped_data_loading.py' | |
>>>print(os.path.realpath(__file__)) | |
C:\Users\XGOBY\LSTMforSHM\src\looped_data_loading.py | |
>>>os.path.realpath(__file__) | |
'C:\\Users\\XGOBY\\LSTMforSHM\\src\\looped_data_loading.py' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment