Unexpected Behavior of os.path.join with Leading Slash in Python
I’ve encountered a peculiar issue with os.path.join in Python. When I add a forward slash (/) in front of the directory variable and pass it to os.path.join, the result is just /Test_directory. However, if I don’t include the forward slash, the full path /home/mvnd3x/Desktop/Test_directory is printed. The same does not happens if I add a forward slash at the end of the parent_directory. Here’s the code I’m working with: