Python - File, directory manipulation
First you should import os modules. import os Get current working folder import os dir = os . getcwd() print(dir) Change current working directory import os dir = os . getcwd() print(dir) os . chdir( "/home" ) dir = os . getcwd() print(dir) Get absolute path for specific path import os dir = os . getcwd() print(dir) os . chdir( "/home" ) dir = os . getcwd() print(dir) os . chdir( "pi" ) abs_dir = os . path . abspath( './rpi-rgb-led-matrix' ) print(abs_dir) # '/home/pi/rpi-rgb-led-matrix' Get only directory name in path import os dir = os . getcwd() print(dir) os . chdir( "/home" ) dir = os . getcwd() print(dir) os . chdir( "pi" ) abs_path = os . path . abspath( './rpi-rgb-led-matrix' ) print(abs_path) dir_name = os . path . dirname( '/home/pi/rpi-rgb-led-matrix/README.md' ) print(dir_name) # '/home/pi/r...