python - permissive equality test on string -


I am a dragon newbie who is very difficult to handle the problem.

The string I have defined is a path, all the spaces were converted into underscores. How can I find out that it corresponds to the actual path?

For example a string like / some / path_to / directory_1 / and_to / directory_2 with a real path: / some / path_to / directory 1 / and_ to / Directory 2

Note that the actual path may include both locations and underscores.

I call it os.path.exists () ???

Thanks alessandro

Use each underscore with a border but [_] :

  import glob glob.glob ('/ some / path_to / directory_1 / and_to / directory_2'. Location ('_', '[_]') )  

Note that if your path is the letter [[/ /], then it will fail. You can send it to [ with [[] . You can decide first instead of

.

Comments