I need to automatically get the document folder address of any Windows with Python.
Currently in my script I determined it as shown in the variable main_folder
, however whenever I change from PC I have to change that address. Below is also one of the uses of this variable in my script .
Creating directories and sub directories. If anyone knows any other method, I will be very grateful.
import arcpy
main_folder = r"C:\Users\Edeson Bizerril\Documents\myEBpy_Files"
# EXEMPLO DE USO
# Determinando diretório
input_folder = main_folder + "\Input\"
input_folder_SRTM = self.input_folder + r"SRTMs\"
create_folder(input_folder)
create_folder(input_folder_SRTM)
# Método para criação de diretórios
def create_folder(path):
if not os.path.isdir(path):
os.makedirs(path)
Unfortunately I need to determine the reference folder in my work, but I would like Python to automatically identify and return the exact same result in the main_folder
variable.