I have a line that contains user input for a directory address on a linux system. I need to check if it is formatted correctly and can be an address in Python 2.6. It is important to note that this is not on the current system, so I cannot check if it exists using os.path, and I cannot try to create directories, since the function will be executed many times.
These lines will always be absolute paths, so my first thought was to look for a leading slash. From there, I wondered if the rest of the string only checks for valid characters and does not contain any double slashes. It seems a bit awkward, any other ideas?
Captastic
source share