check path.exists() with a "converted" path
rplasson at gmail.com
Mon Sep 27 11:46:08 CEST 2010
On Sep 27, 6:23 pm, Alessandro <alexxx.ma... at gmail.com> wrote:
> I have a string defining a path, were all the spaces have been
> converted to underscores.
> notice that the real path can contain BOTH spaces and underscores.
> How can I feed it to os.path.exists() ???
You are losing some information, there is no other choice to test all
Something like this should do the trick (/!\ quick and dirty
for i in range(2**(len(tmp)-1)):
for j in range(len(tmp)):
if (i & 2**(j-1))==0:
res += " "
res += "_"
More information about the Python-list