peter at engcorp.com
Sat Nov 12 03:03:02 CET 2005
Shi Mu wrote:
> On 11/11/05, Fredrik Lundh <fredrik at pythonware.com> wrote:
>>Shi Mu wrote:
>>>def buildList( directory='c:\TEMP' ):
>>> dirs = [ ]
>>> listing = os.listdir(directory)
>>> for x in listing:
>>> x = os.path.join(directory, x)
>>> print x
>>> if os.path.isdir(x):
>>> return dirs
> It works but i am curious why the line of "print x" does not show
> anything. many thanks!
Did you use directory='c:\TEMP' as shown above, or directory='c:\temp' ?
If you used the lower case version, you are not really checking the
temp directory, since \t represents a TAB character. If that's the
case, try using a forward slash instead: c:/temp .
More information about the Python-list