I have a hashtable in python of strings. So, each entry is a string. The strings could possibly start with “/” which implies they are file names.
What would be a quick way to take a hashtable like this, and for each string in it that starts with a “/” verify whether the file exists?
If the file does not exist, then the
I have a hashtable in python of strings. So, each entry is a string.
Share
To find if the string begins with a forward slash:
or
To find if a file is valid:
You can loop through your hashtable using a for statement. Putting it all together (assuming the potential paths are the values in the hashtable [called a dict in python]):