[Tutor] Newbie question.

Alexandre Ratti alex@gabuzomeu.net
Mon, 27 May 2002 10:38:39 +0200


Hi,


At 00:55 27/05/2002 -0400, tutor-request@python.org wrote:
>Date: Sun, 26 May 2002 23:54:50 -0500
>From: SA <sarmstrong13@mac.com>
>Subject: [Tutor] Newbie question.

>I'm trying to use the os.listdir module to list a directory and then store
>that output to a list. I'm probably doing this wrong:
>X = listdir(/)
>
>I get an invalid syntax error.

Yes, you need to enclose the path in quotes or to store it in a variable 
first. Eg.:

import os
os.listdir("/")
# or
thePath = "/"
os.listdir(thePath)


Cheers.

Alexandre