On 3/8/07, learner404 <[EMAIL PROTECTED]> wrote:
> When I know exactly the path in advance I use a raw string r' ' and I add
> double quotes where necessary to avoid the white spaces syndrome. But I
> don't see how to do this "easily" when my path is a string variable given by
> my GUI (like C:\Documents and Settings\name\Mes documents)

You can just choose to always quote the directory name where it might
have spaces in it.  For instance, change this line:
>         result=os.popen("dir "+dirPath).read()
to this:
        result=os.popen('dir "%s"' % dirPath).read()

That worked fine with all the directories I threw at it.

-- 
Jerry
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to