[Errno 13] Permission denied mkdir cheatsheet code example

Example: [Errno 13] Permission denied mkdir cheatsheet

Parent_dir = '/home/user/Documents/'     #parent directory

directory = '/Folder'                    #'/Folder' is the 
                                         #folder to be created.
                                         
path = os.path.join(parent_dir,directory) #Join the parent_dir 
                                          #and directory
mkdir(path) # make directory

#-------------Program output-------------#
#PermissionError: [Errno 13] Permission denied: '/Folder'
#-------------Solution-------------------#
directory = 'Folder' # The / is cause os.path.join() to raise this error.